diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 0577ed73..8e8b3398 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -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); },