You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/_util/BaseMixin.js

41 lines
1.3 KiB

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