ant-design-vue/components/_util/BaseMixin.js
2018-03-12 22:13:59 +08:00

23 lines
676 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export default {
methods: {
setState (state, callback) {
Object.assign(this.$data, typeof state === 'function' ? state(this.$data) : state)
this.$nextTick(() => {
callback && callback()
})
},
__emit () { // 直接调用listeners底层组件不需要vueTool记录events
const args = [].slice.call(arguments, 0)
const filterEvent = []
const eventName = args[0]
if (args.length && this.$listeners[eventName]) {
if (filterEvent.includes(eventName)) {
this.$emit(eventName, ...args.slice(1))
} else {
this.$listeners[eventName](...args.slice(1))
}
}
},
},
}