Commit 7dcfe45d1b2e5895c21f5045997d2eb6ba14bb4c
1 parent
f10b27f9
update Select
Showing
2 changed files
with
13 additions
and
6 deletions
Show diff stats
examples/routers/select.vue
| @@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
| 2 | <Row> | 2 | <Row> |
| 3 | <i-col span="4">{{model}}</i-col> | 3 | <i-col span="4">{{model}}</i-col> |
| 4 | <i-col span="8"> | 4 | <i-col span="8"> |
| 5 | - <i-select v-model="model" multiple filterable remote :remote-method="remoteMethod" :loading="loading" clearable> | ||
| 6 | - <i-option v-for="option in options" :value="option.value" :key="option">{{option.label}}</i-option> | 5 | + <i-select v-model="model" @input="handleInput" multiple filterable remote :remote-method="remoteMethod" :loading="loading" clearable> |
| 6 | + <i-option v-for="option in options" :value="option.value" :key="new Date()">{{option.label}}</i-option> | ||
| 7 | </i-select> | 7 | </i-select> |
| 8 | </i-col> | 8 | </i-col> |
| 9 | </Row> | 9 | </Row> |
| @@ -82,10 +82,13 @@ | @@ -82,10 +82,13 @@ | ||
| 82 | return item.label.toLowerCase() | 82 | return item.label.toLowerCase() |
| 83 | .indexOf(query.toLowerCase()) > -1; | 83 | .indexOf(query.toLowerCase()) > -1; |
| 84 | }); | 84 | }); |
| 85 | - }, 200); | 85 | + }, 500); |
| 86 | } else { | 86 | } else { |
| 87 | this.options = []; | 87 | this.options = []; |
| 88 | } | 88 | } |
| 89 | + }, | ||
| 90 | + handleInput () { | ||
| 91 | +// console.log(1) | ||
| 89 | } | 92 | } |
| 90 | }, | 93 | }, |
| 91 | mounted () { | 94 | mounted () { |
src/components/select/select.vue
| @@ -222,9 +222,12 @@ | @@ -222,9 +222,12 @@ | ||
| 222 | cb(child); | 222 | cb(child); |
| 223 | } else if (child.$children.length) { | 223 | } else if (child.$children.length) { |
| 224 | _this.$nextTick(() => { | 224 | _this.$nextTick(() => { |
| 225 | - child.$children.forEach((innerChild) => { | ||
| 226 | - find(innerChild, cb); | ||
| 227 | - }); | 225 | +// child.$children.forEach((innerChild) => { |
| 226 | +// find(innerChild, cb); | ||
| 227 | +// }); | ||
| 228 | + }); | ||
| 229 | + child.$children.forEach((innerChild) => { | ||
| 230 | + find(innerChild, cb); | ||
| 228 | }); | 231 | }); |
| 229 | } | 232 | } |
| 230 | }; | 233 | }; |
| @@ -300,6 +303,7 @@ | @@ -300,6 +303,7 @@ | ||
| 300 | }, | 303 | }, |
| 301 | updateMultipleSelected (init = false, slot = false) { | 304 | updateMultipleSelected (init = false, slot = false) { |
| 302 | if (this.multiple && Array.isArray(this.model)) { | 305 | if (this.multiple && Array.isArray(this.model)) { |
| 306 | + // todo 这里的 label 有问题,另删除字符时也有问题 | ||
| 303 | let selected = this.remote ? this.selectedMultiple : []; | 307 | let selected = this.remote ? this.selectedMultiple : []; |
| 304 | 308 | ||
| 305 | for (let i = 0; i < this.model.length; i++) { | 309 | for (let i = 0; i < this.model.length; i++) { |