1、在src下创建一个文件夹,文件夹里面放公共方法:
2、定义方法:
(这里是方法需要用到axios不引入的话会报错)
3、声明原型
在main.js中进行,说明入口:Vue.prototype
4、引用公共方法
// 引用公共方法
this.testPMethod.testMethod();
其他页面只要调用方法就行了
1、在src下创建一个文件夹,文件夹里面放公共方法:
2、定义方法:
(这里是方法需要用到axios不引入的话会报错)
3、声明原型
在main.js中进行,说明入口:Vue.prototype
4、引用公共方法
// 引用公共方法
this.testPMethod.testMethod();
其他页面只要调用方法就行了