Commit 4b338397ce62b530935db46ff8ad4b0947c4df66
1 parent
67a9c1cc
update Select example
Showing
2 changed files
with
3 additions
and
57 deletions
Show diff stats
examples/routers/select.vue
... | ... | @@ -168,13 +168,7 @@ |
168 | 168 | <!--</script>--> |
169 | 169 | |
170 | 170 | <template> |
171 | - <div> | |
172 | - {{ model10 }} | |
173 | - <Select v-model="model10" multiple style="width:260px"> | |
174 | - <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> | |
175 | - </Select> | |
176 | - ---------- | |
177 | - {{ model14 }} | |
171 | + <div style="width: 300px"> | |
178 | 172 | <Select |
179 | 173 | v-model="model14" |
180 | 174 | multiple |
... | ... | @@ -184,67 +178,22 @@ |
184 | 178 | :loading="loading2"> |
185 | 179 | <Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option> |
186 | 180 | </Select> |
187 | - <Button @click="clear">clear</Button> | |
188 | 181 | </div> |
189 | 182 | </template> |
190 | 183 | <script> |
191 | 184 | export default { |
192 | 185 | data () { |
193 | 186 | return { |
194 | - cityList: [ | |
195 | - { | |
196 | - value: 'beijing', | |
197 | - label: '北京市' | |
198 | - }, | |
199 | - { | |
200 | - value: 'shanghai', | |
201 | - label: '上海市' | |
202 | - }, | |
203 | - { | |
204 | - value: 'shenzhen', | |
205 | - label: '深圳市' | |
206 | - }, | |
207 | - { | |
208 | - value: 'hangzhou', | |
209 | - label: '杭州市' | |
210 | - }, | |
211 | - { | |
212 | - value: 'nanjing', | |
213 | - label: '南京市' | |
214 | - }, | |
215 | - { | |
216 | - value: 'chongqing', | |
217 | - label: '重庆市' | |
218 | - } | |
219 | - ], | |
220 | - model10: [], | |
221 | 187 | model13: '', |
222 | 188 | loading1: false, |
223 | 189 | options1: [], |
224 | 190 | model14: [], |
225 | 191 | loading2: false, |
226 | 192 | options2: [], |
227 | - list: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New hampshire', 'New jersey', 'New mexico', 'New york', 'North carolina', 'North dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode island', 'South carolina', 'South dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West virginia', 'Wisconsin', 'Wyoming'] | |
193 | + list: ['a', 'b', 'c'] | |
228 | 194 | } |
229 | 195 | }, |
230 | 196 | methods: { |
231 | - remoteMethod1 (query) { | |
232 | - if (query !== '') { | |
233 | - this.loading1 = true; | |
234 | - setTimeout(() => { | |
235 | - this.loading1 = false; | |
236 | - const list = this.list.map(item => { | |
237 | - return { | |
238 | - value: item, | |
239 | - label: item | |
240 | - }; | |
241 | - }); | |
242 | - this.options1 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1); | |
243 | - }, 200); | |
244 | - } else { | |
245 | - this.options1 = []; | |
246 | - } | |
247 | - }, | |
248 | 197 | remoteMethod2 (query) { |
249 | 198 | if (query !== '') { |
250 | 199 | this.loading2 = true; |
... | ... | @@ -261,9 +210,6 @@ |
261 | 210 | } else { |
262 | 211 | this.options2 = []; |
263 | 212 | } |
264 | - }, | |
265 | - clear () { | |
266 | - this.model14 = []; | |
267 | 213 | } |
268 | 214 | } |
269 | 215 | } | ... | ... |
src/components/select/select.vue
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | import { oneOf, findComponentDownward } from '../../utils/assist'; |
55 | 55 | import Emitter from '../../mixins/emitter'; |
56 | 56 | import Locale from '../../mixins/locale'; |
57 | - import {debounce} from './utils'; | |
57 | + import { debounce } from './utils'; | |
58 | 58 | |
59 | 59 | const prefixCls = 'ivu-select'; |
60 | 60 | ... | ... |