ant-design-vue/components/_util/BaseMixin.js

23 lines
676 B
JavaScript
Raw Normal View History

2018-01-12 08:10:41 +00:00
export default {
methods: {
setState (state, callback) {
2018-02-05 11:12:41 +00:00
Object.assign(this.$data, typeof state === 'function' ? state(this.$data) : state)
2018-01-12 08:10:41 +00:00
this.$nextTick(() => {
callback && callback()
})
},
__emit () { // 直接调用listeners底层组件不需要vueTool记录events
const args = [].slice.call(arguments, 0)
2018-01-17 08:12:53 +00:00
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))
}
2018-01-12 08:10:41 +00:00
}
},
},
}