Merge pull request #6310 from ChenguangWang/cg-branch

feat: select 搜索功能情况下问题,只匹配label
This commit is contained in:
debugIsFalse 2019-10-09 10:12:50 +08:00 committed by GitHub
commit 640f39343f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -490,13 +490,12 @@
},
validateOption({children, elm, propsData}){
const value = propsData.value;
const label = propsData.label || '';
const textContent = (elm && elm.textContent) || (children || []).reduce((str, node) => {
const nodeText = node.elm ? node.elm.textContent : node.text;
return `${str} ${nodeText}`;
}, '') || '';
const stringValues = JSON.stringify([value, label, textContent]);
const stringValues = JSON.stringify([label, textContent]);
const query = this.query.toLowerCase().trim();
return stringValues.toLowerCase().includes(query);
},