iview/examples/routers/checkbox.vue

45 lines
1.2 KiB
Vue
Raw Normal View History

2017-03-01 17:58:40 +08:00
<template>
<div>
<div>
<Checkbox true-value="true" false-value="false" v-model="testValue1">test string</Checkbox>
{{ testValue1 }}
</div>
<div>
<Checkbox :true-value="0" :false-value="1" v-model="testValue2">test number</Checkbox>
{{ testValue2 }}
</div>
2017-03-01 17:58:40 +08:00
<Checkbox-group v-model="fruit">
<Checkbox v-for="item in tags" :label="item.label" :key="item.label" true-value="true"></Checkbox>
2017-03-01 17:58:40 +08:00
</Checkbox-group>
2017-04-27 14:33:25 +08:00
<div>{{ fruit }}</div>
2017-03-01 17:58:40 +08:00
</div>
</template>
<script>
export default {
data () {
return {
social: ['facebook', 'github'],
fruit: ['苹果'],
tags: [],
testValue1: null,
testValue2: null
2017-03-01 17:58:40 +08:00
}
},
2017-04-27 14:33:25 +08:00
mounted () {
setTimeout(() => {
this.tags = [
{
label: '香蕉'
},
{
label: '苹果'
},
{
label: '西瓜'
}
]
}, 1000);
2017-03-01 17:58:40 +08:00
}
}
</script>