67 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Vue
		
	
	
			
		
		
	
	
			67 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Vue
		
	
	
| <docs>
 | |
| ---
 | |
| order: 5
 | |
| title: 
 | |
|   zh-CN: 卿
 | |
|   en-US: Dynamic
 | |
| ---
 | |
| 
 | |
| ## zh-CN
 | |
| 
 | |
| åąį¤ē卿ååįææã
 | |
| 
 | |
| ## en-US
 | |
|   
 | |
| The count will be animated as it changes.
 | |
| </docs>
 | |
| 
 | |
| <template>
 | |
|   <div>
 | |
|     <a-badge :count="count">
 | |
|       <a href="#" class="head-example" />
 | |
|     </a-badge>
 | |
|     <a-button-group>
 | |
|       <a-button @click="decline">
 | |
|         <minus-outlined />
 | |
|       </a-button>
 | |
|       <a-button @click="increase">
 | |
|         <plus-outlined />
 | |
|       </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:checked="show" />
 | |
|   </div>
 | |
| </template>
 | |
| <script lang="ts">
 | |
| import { defineComponent, ref } from 'vue';
 | |
| import { MinusOutlined, PlusOutlined } from '@ant-design/icons-vue';
 | |
| export default defineComponent({
 | |
|   components: {
 | |
|     MinusOutlined,
 | |
|     PlusOutlined,
 | |
|   },
 | |
|   setup() {
 | |
|     const count = ref<number>(5);
 | |
|     const decline = () => {
 | |
|       if (count.value >= 1) {
 | |
|         count.value--;
 | |
|       }
 | |
|     };
 | |
| 
 | |
|     const increase = () => {
 | |
|       count.value++;
 | |
|     };
 | |
|     return {
 | |
|       count,
 | |
|       show: ref<boolean>(true),
 | |
|       decline,
 | |
|       increase,
 | |
|     };
 | |
|   },
 | |
| });
 | |
| </script>
 |