From 13a940ee8665eb5c0cb7cf856460a26d924c8015 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Tue, 9 May 2017 11:04:07 +0800 Subject: [PATCH] update Select --- src/components/select/select.vue | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/select/select.vue b/src/components/select/select.vue index b240da5..97a8776 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -196,7 +196,8 @@ }, dropVisible () { let status = true; - if (!this.loading && this.remote && this.query === '' && !this.options.length) status = false; + const options = this.$slots.default || []; + if (!this.loading && this.remote && this.query === '' && !options.length) status = false; return this.visible && status; } }, @@ -214,18 +215,12 @@ }, // find option component findChild (cb) { - const _this = this; const find = function (child) { const name = child.$options.componentName; if (name) { cb(child); } else if (child.$children.length) { - _this.$nextTick(() => { -// child.$children.forEach((innerChild) => { -// find(innerChild, cb); -// }); - }); child.$children.forEach((innerChild) => { find(innerChild, cb); }); @@ -599,7 +594,7 @@ }); } else { this.findChild(child => { - child.selected = this.model.indexOf(child.value) > -1; + child.selected = this.multiple ? this.model.indexOf(child.value) > -1 : this.model === child.value; }); } this.slotChange(); @@ -613,7 +608,7 @@ }); } else { this.findChild(child => { - child.selected = this.model.indexOf(child.value) > -1; + child.selected = this.multiple ? this.model.indexOf(child.value) > -1 : this.model === child.value; }); } this.slotChange(); @@ -685,7 +680,7 @@ } if (this.remote) { this.findChild(child => { - child.selected = this.model.indexOf(child.value) > -1; + child.selected = this.multiple ? this.model.indexOf(child.value) > -1 : this.model === child.value; }); } } -- libgit2 0.21.4