diff --git a/package/component/src/component/selectOption/index.vue b/package/component/src/component/selectOption/index.vue index 9fa74e4f..b2b06f00 100644 --- a/package/component/src/component/selectOption/index.vue +++ b/package/component/src/component/selectOption/index.vue @@ -60,14 +60,13 @@ const selected = computed(() => { } }); -// 首次加载, 不启用 search-method 方法。 -const isFirst = ref(true); +const first = ref(true); const display = computed(() => { - if (searchMethod && !isFirst.value) { - isFirst.value = false; + if (searchMethod && !first.value) { return searchMethod(searchValue.value, props); } + first.value = false; return ( props.keyword?.toString().indexOf(searchValue.value) > -1 || props.label?.toString().indexOf(searchValue.value) > -1 diff --git a/package/document-component/src/document/zh-CN/components/select.md b/package/document-component/src/document/zh-CN/components/select.md index a9d2f0c0..adac5b3d 100644 --- a/package/document-component/src/document/zh-CN/components/select.md +++ b/package/document-component/src/document/zh-CN/components/select.md @@ -122,7 +122,7 @@ export default { - + @@ -138,10 +138,15 @@ export default { const value3 = ref('1') const value4 = ref(['1']) + + const searchMethod = (text, props) => { + return props.label.indexOf(text) != -1; + } return { value3, - value4 + value4, + searchMethod } } } @@ -207,9 +212,10 @@ export default { const value3 = ref('1') const value4 = ref(['1']) + return { value3, - value4 + value4, } } }