Commit 4b338397ce62b530935db46ff8ad4b0947c4df66

Authored by 梁灏
1 parent 67a9c1cc

update Select example

examples/routers/select.vue
@@ -168,13 +168,7 @@ @@ -168,13 +168,7 @@
168 <!--</script>--> 168 <!--</script>-->
169 169
170 <template> 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 <Select 172 <Select
179 v-model="model14" 173 v-model="model14"
180 multiple 174 multiple
@@ -184,67 +178,22 @@ @@ -184,67 +178,22 @@
184 :loading="loading2"> 178 :loading="loading2">
185 <Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option> 179 <Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option>
186 </Select> 180 </Select>
187 - <Button @click="clear">clear</Button>  
188 </div> 181 </div>
189 </template> 182 </template>
190 <script> 183 <script>
191 export default { 184 export default {
192 data () { 185 data () {
193 return { 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 model13: '', 187 model13: '',
222 loading1: false, 188 loading1: false,
223 options1: [], 189 options1: [],
224 model14: [], 190 model14: [],
225 loading2: false, 191 loading2: false,
226 options2: [], 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 methods: { 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 remoteMethod2 (query) { 197 remoteMethod2 (query) {
249 if (query !== '') { 198 if (query !== '') {
250 this.loading2 = true; 199 this.loading2 = true;
@@ -261,9 +210,6 @@ @@ -261,9 +210,6 @@
261 } else { 210 } else {
262 this.options2 = []; 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,7 +54,7 @@
54 import { oneOf, findComponentDownward } from '../../utils/assist'; 54 import { oneOf, findComponentDownward } from '../../utils/assist';
55 import Emitter from '../../mixins/emitter'; 55 import Emitter from '../../mixins/emitter';
56 import Locale from '../../mixins/locale'; 56 import Locale from '../../mixins/locale';
57 - import {debounce} from './utils'; 57 + import { debounce } from './utils';
58 58
59 const prefixCls = 'ivu-select'; 59 const prefixCls = 'ivu-select';
60 60