Vue 引入自定义JS方法/函数步骤详解

接上篇: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

}

更多参考:https://www.cnblogs.com/conglvse/p/10062449.html 

发布了65 篇原创文章 · 获赞 8 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/u012382791/article/details/100632183