vue自定义全局函数
2019-10-15 本文已影响0人
crayona
1main.js中定义
定义Vue.prototype.fn名字=function(){}
使用 this.fn名字()
2自定义.js中定义
a)export.install=function(Vue,options){
Vue.prototype.fnName=function(){}
}
b)import ownjs from 自定义.js
Vue.use(ownjs )
c)组件中使用this.fnName();