2018-09-05 13:28:54 +00:00
|
|
|
|
|
2018-01-12 08:10:41 +00:00
|
|
|
|
export default {
|
2018-12-27 14:14:32 +00:00
|
|
|
|
// directives: {
|
|
|
|
|
// ref: {
|
|
|
|
|
// bind: function (el, binding, vnode) {
|
|
|
|
|
// binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm)
|
|
|
|
|
// },
|
|
|
|
|
// update: function (el, binding, vnode) {
|
|
|
|
|
// binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm)
|
|
|
|
|
// },
|
|
|
|
|
// unbind: function (el, binding, vnode) {
|
|
|
|
|
// binding.value(null)
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
// },
|
2018-01-12 08:10:41 +00:00
|
|
|
|
methods: {
|
|
|
|
|
setState (state, callback) {
|
2018-12-27 14:14:32 +00:00
|
|
|
|
const newState = typeof state === 'function' ? state(this.$data, this.$props) : state
|
2018-12-25 04:00:39 +00:00
|
|
|
|
// if (this.getDerivedStateFromProps) {
|
|
|
|
|
// Object.assign(newState, this.getDerivedStateFromProps(getOptionProps(this), { ...this.$data, ...newState }, true) || {})
|
|
|
|
|
// }
|
2018-09-05 13:28:54 +00:00
|
|
|
|
Object.assign(this.$data, newState)
|
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
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|