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