首页 > 编程知识 正文

vue列表组件封装,vue过滤器不能使用this

时间:2023-05-04 15:58:05 阅读:49162 作者:2735

目录集成包吉鲁

在统一包吉鲁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

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。