接上篇:Vue 引入自定义JS步骤详解
1.同样新建JS文件并引入,JS文件代码如下:
export default {
methods: {
youMethod(param) {
},
},
}
2.模版引入:
import CommonUtils from "../../static/CommonUtils.js"
3.调用:
if (!CommonUtils.methods.youMethod(data.userId)) {
// TODO
}