880db755 by 杨威

定义全局数据过滤方法

1 parent b299b5bf
import Vue from "vue";
//定义key-value过滤方法
function createFilter(filterName, dataArray) {
return Vue.filter(filterName, function(val) {
let label = "";
let arr = dataArray;
arr.forEach((item) => {
if (item.value == val) {
return (label = item.label);
}
});
return label;
});
}
//时间格式过滤
Vue.filter("timeFilter", function(timeStr) {
if (timeStr) {
return timeStr.substring(0, 10);
}
});
//数据类型过滤
let bdcLxArray = [
{
label: "宗地",
value: "zd",
},
{
label: "自然幢",
value: "zrz",
},
];
createFilter("bdcLxFilter", bdcLxArray);
\ No newline at end of file
......@@ -13,6 +13,7 @@ import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
// 将富文本编译器 注册为全局组件
Vue.use(VueQuillEditor)
import "./libs/fliter"; //引入全局过滤器
// 让IE11支持Vue-router跳转功能
if (
'-ms-scroll-limit' in document.documentElement.style &&
......