export default {
install(vue, options) {
console.log(vue);
console.log(options);
// vue.add()
vue.add = function foo(a, b) {
console.log('add result is :', a + b);
};
// this.reduce()
vue.prototype.reduce = function bar(a, b) {
console.log('reduce:', a - b);
};
vue.directive('form', {
acceptStatement: true,
bind(el, binding, vnode, oldVnode) {
// 获取绑定的元素,节点。。。
console.log('bind', el, binding, vnode, oldVnode);
},
unbind() {
console.log('unbind');
},
update(fn) {
console.log('fn is ', fn);
},
});
// mixin 混合created()
vue.mixin({
created() {
console.log('组件开始加载');
}
});
},
};