2018-02-07 10:44:11 +00:00
|
|
|
<cn>
|
|
|
|
#### 动态
|
|
|
|
展示动态变化的效果。
|
|
|
|
</cn>
|
|
|
|
|
|
|
|
<us>
|
|
|
|
#### Dynamic
|
|
|
|
The count will be animated as it changes.
|
|
|
|
</us>
|
|
|
|
|
|
|
|
```html
|
|
|
|
<template>
|
2018-03-09 09:50:33 +00:00
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<a-badge :count="count">
|
|
|
|
<a href="#" class="head-example" />
|
|
|
|
</a-badge>
|
|
|
|
<a-button-group>
|
|
|
|
<a-button @click="decline">
|
|
|
|
<a-icon type="minus" />
|
|
|
|
</a-button>
|
|
|
|
<a-button @click="increase">
|
|
|
|
<a-icon type="plus" />
|
|
|
|
</a-button>
|
|
|
|
</a-button-group>
|
|
|
|
</div>
|
|
|
|
<div style="margin-top: 10px">
|
|
|
|
<a-badge :dot="show">
|
|
|
|
<a href="#" class="head-example" />
|
|
|
|
</a-badge>
|
|
|
|
<a-switch v-model="show" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-02-07 10:44:11 +00:00
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data(){
|
|
|
|
return {
|
2018-03-09 09:50:33 +00:00
|
|
|
count: 5,
|
|
|
|
show: true,
|
2018-02-07 10:44:11 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
decline () {
|
|
|
|
let count = this.count - 1
|
|
|
|
if (count < 0) {
|
|
|
|
count = 0
|
|
|
|
}
|
|
|
|
this.count = count
|
|
|
|
},
|
|
|
|
increase () {
|
2018-03-09 09:50:33 +00:00
|
|
|
this.count++
|
2018-02-07 10:44:11 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2018-03-09 09:50:33 +00:00
|
|
|
</script>
|
2018-02-07 10:44:11 +00:00
|
|
|
```
|