Commit c1f6da1f8e67e7f504afc4b2153211c13ffad96b
1 parent
fc640135
fixed CheckboxGroup bug
fixed CheckboxGroup bug
Showing
3 changed files
with
25 additions
and
41 deletions
Show diff stats
src/components/checkbox/checkbox-group.vue
| @@ -43,11 +43,12 @@ | @@ -43,11 +43,12 @@ | ||
| 43 | }, | 43 | }, |
| 44 | watch: { | 44 | watch: { |
| 45 | model (val, oldVal) { | 45 | model (val, oldVal) { |
| 46 | - if (val == oldVal) { | ||
| 47 | - this.updateModel(); | ||
| 48 | - } else { | ||
| 49 | - this.updateModel(true); | ||
| 50 | - } | 46 | +// if (val == oldVal) { |
| 47 | +// this.updateModel(); | ||
| 48 | +// } else { | ||
| 49 | +// this.updateModel(true); | ||
| 50 | +// } | ||
| 51 | + this.updateModel(true); | ||
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| 53 | } | 54 | } |
test/routers/date.vue
| @@ -7,16 +7,15 @@ | @@ -7,16 +7,15 @@ | ||
| 7 | <i-col span="8"> | 7 | <i-col span="8"> |
| 8 | <!--<i-button @click="setDate">set date</i-button>--> | 8 | <!--<i-button @click="setDate">set date</i-button>--> |
| 9 | <date-picker | 9 | <date-picker |
| 10 | - :type="type" | 10 | + type="month" |
| 11 | style="width:200px" | 11 | style="width:200px" |
| 12 | placeholder="请选择日期" | 12 | placeholder="请选择日期" |
| 13 | :value.sync="value" | 13 | :value.sync="value" |
| 14 | @on-change="change" | 14 | @on-change="change" |
| 15 | - :confirm="true" | 15 | + :confirm="false" |
| 16 | :options="options" | 16 | :options="options" |
| 17 | open | 17 | open |
| 18 | @on-open-change="change2"> | 18 | @on-open-change="change2"> |
| 19 | - <p>123</p> | ||
| 20 | </date-picker> | 19 | </date-picker> |
| 21 | </i-col> | 20 | </i-col> |
| 22 | <i-col span="8"> | 21 | <i-col span="8"> |
test/routers/more.vue
| 1 | -<style> | ||
| 2 | - .ivu-col div.aaaaa{ | ||
| 3 | - height: 100px; | ||
| 4 | - line-height: 100px; | ||
| 5 | - text-align: center; | ||
| 6 | - color: #fff; | ||
| 7 | - background: rgba(0, 153, 229, .9); | ||
| 8 | - } | ||
| 9 | - .ivu-col:nth-child(odd) div.aaaaa{ | ||
| 10 | - background: rgba(0, 153, 229, .7); | ||
| 11 | - } | ||
| 12 | -</style> | ||
| 13 | <template> | 1 | <template> |
| 14 | - <Row> | ||
| 15 | - <i-col :xs="2" :sm="4" :md="6" :lg="8"><div class="aaaaa">Col 1</div></i-col> | ||
| 16 | - <i-col :xs="20" :sm="16" :md="12" :lg="8"><div class="aaaaa">Col 2</div></i-col> | ||
| 17 | - <i-col :xs="2" :sm="4" :md="6" :lg="8"><div class="aaaaa">Col 3</div></i-col> | ||
| 18 | - </Row> | ||
| 19 | - <br><br> | ||
| 20 | - <Row> | ||
| 21 | - <i-col :xs="{ span: 5, offset: 1 }" :lg="{ span: 6, offset: 2 }"><div class="aaaaa">Col 1</div></i-col> | ||
| 22 | - <i-col :xs="{ span: 11, offset: 1 }" :lg="{ span: 6, offset: 2 }"><div class="aaaaa">Col 2</div></i-col> | ||
| 23 | - <i-col :xs="{ span: 5, offset: 1 }" :lg="{ span: 6, offset: 2 }"><div class="aaaaa">Col 3</div></i-col> | ||
| 24 | - </Row> | ||
| 25 | - <i-button @click="start">Start</i-button> | ||
| 26 | - <i-button @click="finish">Finish</i-button> | ||
| 27 | - <i-button @click="error">Error</i-button> | 2 | + {{ fruit |json}} |
| 3 | + <Checkbox-group :model.sync="fruit" @on-change="changed"> | ||
| 4 | + <Checkbox value="a"></Checkbox> | ||
| 5 | + <Checkbox value="b"></Checkbox> | ||
| 6 | + <Checkbox value="c"></Checkbox> | ||
| 7 | + </Checkbox-group> | ||
| 8 | + <i-button @click="change">change</i-button> | ||
| 28 | </template> | 9 | </template> |
| 29 | <script> | 10 | <script> |
| 30 | export default { | 11 | export default { |
| 12 | + data () { | ||
| 13 | + return { | ||
| 14 | + fruit: ['b'] | ||
| 15 | + } | ||
| 16 | + }, | ||
| 31 | methods: { | 17 | methods: { |
| 32 | - start () { | ||
| 33 | - this.$Loading.start(); | ||
| 34 | - }, | ||
| 35 | - finish () { | ||
| 36 | - this.$Loading.finish(); | 18 | + change () { |
| 19 | + this.fruit.splice(0, 1); | ||
| 20 | +// this.fruit = ['a'] | ||
| 37 | }, | 21 | }, |
| 38 | - error () { | ||
| 39 | - this.$Loading.error(); | 22 | + changed (s) { |
| 23 | + console.log(s) | ||
| 40 | } | 24 | } |
| 41 | } | 25 | } |
| 42 | } | 26 | } |