方法一:使用Vue.prototype在mian.js中写入函数Vue.prototype.getToken = function (){
...
}
在所有组件里可调用函数this.getToken();
方法二:使用exports.install+Vue.prototype写好自己需要的fun.js文件exports.install = function (Vue, options) {
Vue.prototype.getToken = function (){
...
...
首页
标签词为 "自定义函数" 的文章