From ed4162cbd57526c69184edb08949b683a0147112 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 18 Aug 2021 14:36:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96select2=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit perf: 优化select2 perf: 修改初始值 --- src/components/FormFields/Select2.vue | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/FormFields/Select2.vue b/src/components/FormFields/Select2.vue index c442d949e..6be32e9bb 100644 --- a/src/components/FormFields/Select2.vue +++ b/src/components/FormFields/Select2.vue @@ -2,6 +2,7 @@ { + this.initialized = true + this.iValue = this.value + }) } this.$nextTick(() => { // 因为elform存在问题,这个来清楚验证 @@ -243,9 +247,13 @@ export default { // this.$log.debug('Select ajax config', this.iAjax) if (this.iAjax.url) { if (this.value && this.value.length !== 0) { - this.$log.debug('Start init select2 value') - const data = await createSourceIdCache(this.value) - this.params.spm = data.spm + this.$log.debug('Start init select2 value, ', this.value) + let value = this.value + if (!Array.isArray(value)) { + value = [value] + } + const data = await createSourceIdCache(value) + this.params.spm = data['spm'] await this.getInitialOptions() } await this.getOptions()