Select add filter-by-label prop
This commit is contained in:
parent
40c64eeb8b
commit
ac618af2e6
1 changed files with 7 additions and 1 deletions
|
@ -273,6 +273,12 @@
|
||||||
default () {
|
default () {
|
||||||
return !this.$IVIEW ? true : this.$IVIEW.capture;
|
return !this.$IVIEW ? true : this.$IVIEW.capture;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// 4.2.0
|
||||||
|
// 搜索时,只按 label 进行搜索
|
||||||
|
filterByLabel: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
@ -528,7 +534,7 @@
|
||||||
const nodeText = node.elm ? node.elm.textContent : node.text;
|
const nodeText = node.elm ? node.elm.textContent : node.text;
|
||||||
return `${str} ${nodeText}`;
|
return `${str} ${nodeText}`;
|
||||||
}, '') || '';
|
}, '') || '';
|
||||||
const stringValues = JSON.stringify([value, label, textContent]);
|
const stringValues = this.filterByLabel ? JSON.stringify([label]) : JSON.stringify([value, label, textContent]);
|
||||||
const query = this.query.toLowerCase().trim();
|
const query = this.query.toLowerCase().trim();
|
||||||
return stringValues.toLowerCase().includes(query);
|
return stringValues.toLowerCase().includes(query);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue