iview/examples/routers/select.vue

55 lines
1.5 KiB
Vue
Raw Normal View History

<template>
2018-07-02 11:02:06 +08:00
<div>
<Select v-model="model1" style="width:200px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Select v-model="model2" multiple style="width:200px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
2018-09-25 15:04:56 +08:00
<Button type="primary" @click="changeData">changeData</Button>
2018-07-02 11:02:06 +08:00
</div>
</template>
<script>
2018-06-28 11:48:30 +08:00
export default {
data () {
return {
cityList: [
{
value: 'New York',
label: 'New York'
},
{
value: 'London',
label: 'London'
},
{
value: 'Sydney',
label: 'Sydney'
},
{
value: 'Ottawa',
label: 'Ottawa'
},
{
value: 'Paris',
label: 'Paris'
},
{
value: 'Canberra',
label: 'Canberra'
}
],
2018-07-02 11:02:06 +08:00
model1: '',
model2: []
2018-06-28 11:48:30 +08:00
}
2018-09-25 15:04:56 +08:00
},
methods: {
changeData() {
this.model2.push('Canberra')
}
2018-06-28 11:48:30 +08:00
}
}
2017-09-14 15:49:37 +08:00
</script>