2018-02-07 18:44:11 +08:00
|
|
|
<cn>
|
|
|
|
#### 动态
|
|
|
|
展示动态变化的效果。
|
|
|
|
</cn>
|
|
|
|
|
|
|
|
<us>
|
|
|
|
#### Dynamic
|
|
|
|
The count will be animated as it changes.
|
|
|
|
</us>
|
|
|
|
|
2019-10-09 18:32:23 +08:00
|
|
|
```tpl
|
2018-02-07 18:44:11 +08:00
|
|
|
<template>
|
2018-03-09 17:50:33 +08: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 18:44:11 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-09-28 20:45:07 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
count: 5,
|
|
|
|
show: true,
|
|
|
|
};
|
2018-02-07 18:44:11 +08:00
|
|
|
},
|
2019-09-28 20:45:07 +08:00
|
|
|
methods: {
|
|
|
|
decline() {
|
|
|
|
let count = this.count - 1;
|
|
|
|
if (count < 0) {
|
|
|
|
count = 0;
|
|
|
|
}
|
|
|
|
this.count = count;
|
|
|
|
},
|
|
|
|
increase() {
|
|
|
|
this.count++;
|
|
|
|
},
|
2018-02-07 18:44:11 +08:00
|
|
|
},
|
2019-09-28 20:45:07 +08:00
|
|
|
};
|
2018-03-09 17:50:33 +08:00
|
|
|
</script>
|
2018-02-07 18:44:11 +08:00
|
|
|
```
|