iview/test/routers/select.vue

69 lines
2.1 KiB
Vue
Raw Normal View History

<template>
2017-01-13 17:10:57 +08:00
<i-button type="primary" @click="modal1 = true">i-selelct加入width样式</i-button>
<i-button type="primary" @click="modal2 = true">i-selelct没有加入width样式</i-button>
<Modal
:visible.sync="modal1"
title="普通的Modal对话框标题">
<i-select :model.sync="model1" :style="modalStyle">
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
</Modal>
<Modal
:visible.sync="modal2"
title="普通的Modal对话框标题">
<i-select :model.sync="model1" :style="modalStyle">
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
</Modal>
</template>
<script>
export default {
data () {
return {
2017-01-13 17:10:57 +08:00
modal1: false,
modal2: false,
modalStyle: '',
2016-11-03 13:54:21 +08:00
cityList: [
{
value: 'beijing',
2017-01-11 18:04:29 +08:00
label: '北京市'
2016-11-03 13:54:21 +08:00
},
{
value: 'shanghai',
2017-01-11 18:04:29 +08:00
label: '上海市'
2016-11-03 13:54:21 +08:00
},
{
value: 'shenzhen',
2017-01-11 18:04:29 +08:00
label: '深圳市'
},
{
value: 'hangzhou',
label: '杭州市'
},
{
value: 'nanjing',
label: '南京市'
2016-12-02 15:15:54 +08:00
},
{
value: 'chongqing',
2017-01-11 18:04:29 +08:00
label: '重庆市'
2016-12-02 15:15:54 +08:00
}
2016-11-03 13:54:21 +08:00
],
2017-01-13 17:10:57 +08:00
model1: ''
}
},
computed: {
modalStyle: function(){
let s = ""
if (this.modal1)
s = "width: 200px"
if (this.modal2)
s = ""
return s
}
}
}
2016-11-03 13:54:21 +08:00
</script>