mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
25 lines
461 B
JavaScript
25 lines
461 B
JavaScript
export default function (events = {
|
|
change: 'change',
|
|
blur: 'blur',
|
|
focus: 'focus',
|
|
input: 'input'
|
|
}) {
|
|
return {
|
|
inject: {
|
|
NFormItem: {
|
|
default: null
|
|
}
|
|
},
|
|
created () {
|
|
Object.keys(events).forEach(event => {
|
|
const asEvent = events[event]
|
|
this.$on(event, function (value) {
|
|
if (this.NFormItem) {
|
|
this.NFormItem.$emit(asEvent, value)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|