You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/badge/demo/index.vue

135 lines
3.1 KiB

<template>
<div>
7 years ago
基本
<div>
7 years ago
<a-badge count=5>
7 years ago
<a href="#" class="head-example" />
7 years ago
</a-badge>
<a-badge count=0 showZero>
7 years ago
<a href="#" class="head-example" />
7 years ago
</a-badge>
7 years ago
</div>
<br>
独立使用
<div>
7 years ago
<a-badge count=25 />
<a-badge count=4 :styles="{backgroundColor: '#fff', color: '#999', boxShadow: '0 0 0 1px #d9d9d9 inset'}" />
<a-badge count=109 :styles= "{backgroundColor: '#52c41a'} " />
7 years ago
</div>
<br>
封顶数字
<div style="margin-top: 10px">
7 years ago
<a-badge count=99>
7 years ago
<a href="#" class="head-example" />
7 years ago
</a-badge>
<a-badge count=100>
7 years ago
<a href="#" class="head-example" />
7 years ago
</a-badge>
<a-badge count=99 overflowCount=10>
7 years ago
<a href="#" class="head-example" />
7 years ago
</a-badge>
<a-badge count=1000 overflowCount=999>
7 years ago
<a href="#" class="head-example" />
7 years ago
</a-badge>
7 years ago
</div>
<br>
讨嫌的小红点
<div style="margin-top: 10px">
7 years ago
<a-badge dot>
<a-icon type="notification" />
</a-badge>
<a-badge dot>
7 years ago
<a href="#">Link something</a>
7 years ago
</a-badge>
7 years ago
</div>
<br>
状态点
<div>
7 years ago
<a-badge status="success" />
<a-badge status="error" />
<a-badge status="default" />
<a-badge status="processing" />
<a-badge :status="currentStatus" />
<a-button @click="changeStatus">processing</a-button>
<br />
7 years ago
<a-badge status="success" text="Success" />
<br />
7 years ago
<a-badge status="error" text="Error" />
<br />
7 years ago
<a-badge status="default" text="Default" />
<br />
7 years ago
<a-badge status="processing" text="Processing" />
<br />
7 years ago
<a-badge status="warning" text="Warning" />
</div>
<br />
7 years ago
动态
<div>
7 years ago
<a-badge :count="count">
<a href="#" class="head-example" />
7 years ago
</a-badge>
<a-button @click="changeMinsValue()">
<a-icon type="minus" />
</a-button>
<a-button @click="changePlusValue(1)">
<a-icon type="plus" />
</a-button>
<br/>
7 years ago
<a-badge :dot="isShow">
<a href="#" class="head-example" />
7 years ago
</a-badge>
<a-button @click="changeShow()">toggle</a-button>
</div>
<br />
</div>
</template>
<script>
7 years ago
let i = 0
export default {
data () {
return {
currentStatus: 'warning',
7 years ago
count: 3,
isShow: true,
}
},
methods: {
changeStatus () {
this.currentStatus = 'processing'
},
7 years ago
changeMinsValue () {
i++
console.dir(i)
let count = this.count - 1
if (count < 0) {
count = 0
}
this.count = count
},
changePlusValue () {
7 years ago
// setInterval(() => {
// const count = this.count + 1
// this.count = count
// }, 300)
const count = this.count + 1
this.count = count
},
changeShow () {
this.isShow = !this.isShow
},
},
}
</script>
<style scoped>
.head-example {
width: 42px;
height: 42px;
7 years ago
border-radius: 4px;
background: #eee;
display: inline-block;
}
7 years ago
.ant-badge{
margin-right: 20px;
}
</style>