Select add filter-by-label prop

This commit is contained in:
梁灏 2020-04-08 14:27:23 +08:00
parent 40c64eeb8b
commit ac618af2e6

View file

@ -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);
},