creates the filters folder, which creates a filters.js file to define the global filter
filters.js
let filterOne = (value) => {
return value * 10
}
let filterTwo = (value, pm) => {
return value * pm
}
export default {
filterOne,
filterTwo
}
main.js
import filters from './filters/filters.js'
for (let value in filters) {
// value是filter名称(字符串)
// filters[value] 对象里面的某个元素,就是filters中定义的方法
Vue.filter(value, filters[value])
}
thus defines all filters globally and can be used in the interface.
年龄:{{ age | filterOne | filterTwo(0.5) }}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。