This commit is contained in:
杰 朱
2021-10-20 21:11:38 +08:00
parent 8df04ff12e
commit 0cd0b70837

View File

@@ -20,6 +20,7 @@ export default {
title: ""
}
],
data3:[],
tableColumnsFilters: [],
search: {} //过滤条件保存的对象,就是保存Input框和Select中值
};
@@ -60,15 +61,17 @@ export default {
//过滤为 下拉选择框
if (
this.columns[index].filter.type &&
this.columns[index].filter.type != "Input"
this.columns[index].filter.type != "Input"
) {
render = h => {
return h(
this.columns[index].filter.type,
{
props: {
value: 0, //Select选项列表一般 0 为全部
transfer: true
value: '', //Select选项列表一般 0 为全部
transfer: true,
data :this.data3,
filterMethod:this.filterMethod,
},
on: {
"on-change": val => {
@@ -87,8 +90,7 @@ export default {
this.createOptionsRender(index, h)
);
};
}
else {
} else {
//如果是输入框
render = h => {
//获取输入框的值,为了减少数据库的压力,我这里是
@@ -99,8 +101,7 @@ export default {
return h(this.columns[index].filter.type, {
props: {
placeholder: "输入" + this.columns[index].title,
icon: "ios-search-strong",
transfer: false
icon: "ios-search-strong"
},
on: {
input: val => {
@@ -109,6 +110,7 @@ export default {
this.validInputValue(index, inputValue);
}
},
//input框后面的搜索按钮的点击事件
"on-click": () => {
this.validInputValue(index, inputValue);
@@ -147,10 +149,18 @@ export default {
}
return optionRender;
},
filterMethod(value, option) {
return option.toUpperCase().indexOf(value.toUpperCase()) !== -1;
},
//重新加载数据
load() {
//会执行一个load的事件
this.$emit("on-search", this.search);
this.data.forEach(item => {
//console.log(1)
this.data3.push(item)
});
},
//验证输入框的值
validInputValue(index, inputValue) {