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.
34 lines
814 B
34 lines
814 B
export default { |
|
install(Vue) { |
|
// 全局过滤器 |
|
Vue.filter("mySlice", function (value) { |
|
return value.slice(0, 4) |
|
}) |
|
|
|
// 全局指令 |
|
Vue.directive("fbind", { |
|
bind(element, binding) { |
|
element.value = binding.value |
|
}, |
|
inserted(element, binding) { |
|
element.focus() |
|
}, |
|
update(element, binding) { |
|
element.value = binding.value |
|
} |
|
}) |
|
|
|
// 定义混入 |
|
Vue.mixin({ |
|
data() { |
|
return { |
|
x: 100, |
|
y: 200 |
|
} |
|
} |
|
}) |
|
|
|
// 给Vue原型上添加一个方法 |
|
Vue.prototype.hello = ()=> {alert('Hello')} |
|
} |
|
} |