vue filter 过滤器

//filter.js 文件
 
let filter_price = function (val,...params){
    return "¥" + val
}
let filter_date = function (){
    return "2019/10/20" + val
}
export {filter_price,filter_date} //导出过滤函数



//main.js
import * as filter from './filters/filter'
console.log(filter)
Object.keys(_filter).forEach(item=>{
Vue.filter(item,_filter[item])
})

new Vue({
router,store,
render: h => h(App),
}).$mount('#app')




 

posted @ 2020-03-25 11:11  崔凯通  阅读(184)  评论(0编辑  收藏  举报