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 () {
|
||||
return !this.$IVIEW ? true : this.$IVIEW.capture;
|
||||
}
|
||||
},
|
||||
// 4.2.0
|
||||
// 搜索时,只按 label 进行搜索
|
||||
filterByLabel: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
|
@ -528,7 +534,7 @@
|
|||
const nodeText = node.elm ? node.elm.textContent : node.text;
|
||||
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();
|
||||
return stringValues.toLowerCase().includes(query);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue