From d51cf1d55ed718d94a1a7c8c9201e339cdacd01f Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 26 Jul 2022 22:58:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E6=A8=A1=E7=B3=8A=E6=90=9C=E7=B4=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ElVisualSelect/index.vue | 15 ++++++++++++++- .../src/components/widget/DeWidget/DeSelect.vue | 10 ++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/ElVisualSelect/index.vue b/frontend/src/components/ElVisualSelect/index.vue index 844c8ba0f9..96596484aa 100644 --- a/frontend/src/components/ElVisualSelect/index.vue +++ b/frontend/src/components/ElVisualSelect/index.vue @@ -40,6 +40,10 @@ export default { value: { type: [String, Number, Array], default: '' + }, + keyWord: { + type: String, + default: '' } }, data() { @@ -80,7 +84,16 @@ export default { this.init() }) }) - } + }, + keyWord(val, old) { + if(val === old) return + const results = val ? this.list.filter(item => item.text.includes(val)) : null + this.resetList(results) + this.reCacularHeight() + this.$nextTick(() => { + this.callback() + }) + }, }, mounted() { this.resetList() diff --git a/frontend/src/components/widget/DeWidget/DeSelect.vue b/frontend/src/components/widget/DeWidget/DeSelect.vue index 6845f3bd2e..969c2b556e 100644 --- a/frontend/src/components/widget/DeWidget/DeSelect.vue +++ b/frontend/src/components/widget/DeWidget/DeSelect.vue @@ -12,6 +12,8 @@ :popper-append-to-body="inScreen" :size="size" :filterable="true" + :filter-method="filterMethod" + :key-word="keyWord" popper-class="coustom-de-select" :list="datas" @change="changeValue" @@ -71,7 +73,8 @@ export default { show: true, value: null, datas: [], - onFocus: false + onFocus: false, + keyWord: '' } }, computed: { @@ -203,6 +206,9 @@ export default { bus.$off('reset-default-value', this.resetDefaultValue) }, methods: { + filterMethod(key) { + this.keyWord = key + }, onScroll() { if (this.onFocus) { this.$refs.deSelect.blur() @@ -215,7 +221,7 @@ export default { } }, onBlur() { - this.onFocus = false + // this.onFocus = false }, handleElTagStyle() { setTimeout(() => {