//main.js
import * as filters from './filters' // console.log(filters); Object.keys(filters).forEach(key => { Vue.filter(key, filters[key]) })
//filters.js
export function gender(val) { return ["未知", "男", "女"][val]; } export function boolText(val) { return ["否", "是"][val]; } export function strTrim(val, len, start = 0) { if (!val) { return ''; } return val.slice(start, len) } export function statusText(val) { return ["禁用", "启用"][val]; }