fixed CheckboxGroup bug

fixed CheckboxGroup bug
This commit is contained in:
梁灏 2016-12-21 20:48:11 +08:00
parent fc640135d6
commit c1f6da1f8e
3 changed files with 25 additions and 41 deletions

View file

@ -43,11 +43,12 @@
}, },
watch: { watch: {
model (val, oldVal) { model (val, oldVal) {
if (val == oldVal) { // if (val == oldVal) {
this.updateModel(); // this.updateModel();
} else { // } else {
this.updateModel(true); // this.updateModel(true);
} // }
this.updateModel(true);
} }
} }
} }

View file

@ -7,16 +7,15 @@
<i-col span="8"> <i-col span="8">
<!--<i-button @click="setDate">set date</i-button>--> <!--<i-button @click="setDate">set date</i-button>-->
<date-picker <date-picker
:type="type" type="month"
style="width:200px" style="width:200px"
placeholder="请选择日期" placeholder="请选择日期"
:value.sync="value" :value.sync="value"
@on-change="change" @on-change="change"
:confirm="true" :confirm="false"
:options="options" :options="options"
open open
@on-open-change="change2"> @on-open-change="change2">
<p>123</p>
</date-picker> </date-picker>
</i-col> </i-col>
<i-col span="8"> <i-col span="8">

View file

@ -1,42 +1,26 @@
<style>
.ivu-col div.aaaaa{
height: 100px;
line-height: 100px;
text-align: center;
color: #fff;
background: rgba(0, 153, 229, .9);
}
.ivu-col:nth-child(odd) div.aaaaa{
background: rgba(0, 153, 229, .7);
}
</style>
<template> <template>
<Row> {{ fruit |json}}
<i-col :xs="2" :sm="4" :md="6" :lg="8"><div class="aaaaa">Col 1</div></i-col> <Checkbox-group :model.sync="fruit" @on-change="changed">
<i-col :xs="20" :sm="16" :md="12" :lg="8"><div class="aaaaa">Col 2</div></i-col> <Checkbox value="a"></Checkbox>
<i-col :xs="2" :sm="4" :md="6" :lg="8"><div class="aaaaa">Col 3</div></i-col> <Checkbox value="b"></Checkbox>
</Row> <Checkbox value="c"></Checkbox>
<br><br> </Checkbox-group>
<Row> <i-button @click="change">change</i-button>
<i-col :xs="{ span: 5, offset: 1 }" :lg="{ span: 6, offset: 2 }"><div class="aaaaa">Col 1</div></i-col>
<i-col :xs="{ span: 11, offset: 1 }" :lg="{ span: 6, offset: 2 }"><div class="aaaaa">Col 2</div></i-col>
<i-col :xs="{ span: 5, offset: 1 }" :lg="{ span: 6, offset: 2 }"><div class="aaaaa">Col 3</div></i-col>
</Row>
<i-button @click="start">Start</i-button>
<i-button @click="finish">Finish</i-button>
<i-button @click="error">Error</i-button>
</template> </template>
<script> <script>
export default { export default {
data () {
return {
fruit: ['b']
}
},
methods: { methods: {
start () { change () {
this.$Loading.start(); this.fruit.splice(0, 1);
// this.fruit = ['a']
}, },
finish () { changed (s) {
this.$Loading.finish(); console.log(s)
},
error () {
this.$Loading.error();
} }
} }
} }