From 5352f31f16dc5f17eb23b1642c8d4bffca73779b Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 17 Oct 2016 23:20:47 +0800 Subject: [PATCH] fix multiple remote select's default value issue --- CHANGELOG.md | 1 + packages/select/src/select.vue | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b7c5088b..a8bfbdd66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - 修复 DatePicker 弹出框样式溢出边框 #318 - 新增 Input 图标的点击事件 #444 - 修复 Loading 关闭后有几率滚动失效的问题 +- 修复 远程搜索的 Select 不能正确渲染默认初始值的问题 #### 非兼容性更新 diff --git a/packages/select/src/select.vue b/packages/select/src/select.vue index 1729f54f0..0e5664133 100644 --- a/packages/select/src/select.vue +++ b/packages/select/src/select.vue @@ -528,6 +528,14 @@ }, mounted() { + if (this.remote && this.multiple && Array.isArray(this.value)) { + this.selected = this.options.reduce((prev, curr) => { + return this.value.indexOf(curr.value) > -1 ? prev.concat(curr) : prev; + }, []); + this.$nextTick(() => { + this.resetInputHeight(); + }); + } this.$nextTick(() => { if (this.$refs.reference.$el) { this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;