目录集成包吉鲁
在统一包吉鲁1、src文件夹下创建filters文件夹,在filters文件夹下创建index.js (即src/filters/index.js )文件,并在main.js上创建src/filters 使用遍历底部的VUE.filters时,在new VUE ()上编写遍历代码3、在src/utils文件夹下的文件中创建各种工具类方法4、src/filters/index.
src/utils/index.js
/**数字/浮点数n位的小数点* @param {*} val值* @param {*} num位*/exportconstnumtofixed=(val=0,num=2) ) val=number 033
import * asindexfrom ' ./utils/index '/* *数字/浮点数为n位小数* @param {*} val值* @param {*} num位数*/exportconstnumtum
//thevuebuildversiontoloadwiththe ` import ` command//(运行时-在线标准) hasbeensetinwebpack.base.confwithanalias.importvuefrom ' vue ' importappfrom './app ' importrouter ' . 点1 vue.config.production tip=false object.keys (filters ).foreach(key={vue.filter ) ) key,filters )。 在new Vue之前/* eslint-disable no-new */newvue ({ El : ' # app ',router,components3360 ) app},template3360'app