在组件的script标签内直接引入:
import myFunction from '@/util/custom.js';
开始使用自定义js中的方法:
export default { // ... other Vue component options methods: { someMethod() { // Call the custom function from your custom.js myFunction.customFunction(); // You can also call any other function or variable defined in custom.js }, }, };
标签:function,vue,自定义,custom,other,组件,js From: https://www.cnblogs.com/Tpf386/p/17578988.html