ant-design-vue/components/badge/demo/index.vue

135 lines
3.1 KiB
Vue
Raw Normal View History

2017-11-16 10:29:02 +00:00
<template>
<div>
2017-12-28 10:46:31 +00:00
基本
<div>
2018-01-23 10:55:39 +00:00
<a-badge count=5>
2017-12-28 10:46:31 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
<a-badge count=0 showZero>
2017-12-28 10:46:31 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
2017-12-28 10:46:31 +00:00
</div>
<br>
独立使用
<div>
2018-01-23 10:55:39 +00:00
<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'} " />
2017-12-28 10:46:31 +00:00
</div>
<br>
封顶数字
<div style="margin-top: 10px">
2018-01-23 10:55:39 +00:00
<a-badge count=99>
2017-12-28 10:46:31 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
<a-badge count=100>
2017-12-28 10:46:31 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
<a-badge count=99 overflowCount=10>
2017-12-28 10:46:31 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
<a-badge count=1000 overflowCount=999>
2017-12-28 10:46:31 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
2017-12-28 10:46:31 +00:00
</div>
<br>
讨嫌的小红点
<div style="margin-top: 10px">
2018-01-23 10:55:39 +00:00
<a-badge dot>
<a-icon type="notification" />
</a-badge>
<a-badge dot>
2017-12-28 10:46:31 +00:00
<a href="#">Link something</a>
2018-01-23 10:55:39 +00:00
</a-badge>
2017-12-28 10:46:31 +00:00
</div>
<br>
状态点
2017-11-16 10:29:02 +00:00
<div>
2018-01-23 10:55:39 +00:00
<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>
2017-11-16 10:29:02 +00:00
<br />
2018-01-23 10:55:39 +00:00
<a-badge status="success" text="Success" />
2017-11-16 10:29:02 +00:00
<br />
2018-01-23 10:55:39 +00:00
<a-badge status="error" text="Error" />
2017-11-16 10:29:02 +00:00
<br />
2018-01-23 10:55:39 +00:00
<a-badge status="default" text="Default" />
2017-11-16 10:29:02 +00:00
<br />
2018-01-23 10:55:39 +00:00
<a-badge status="processing" text="Processing" />
2017-11-16 10:29:02 +00:00
<br />
2018-01-23 10:55:39 +00:00
<a-badge status="warning" text="Warning" />
2017-11-16 10:29:02 +00:00
</div>
<br />
2017-12-28 10:46:31 +00:00
动态
2017-11-16 10:29:02 +00:00
<div>
2018-01-23 10:55:39 +00:00
<a-badge :count="count">
2017-11-16 10:29:02 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
<a-button @click="changeMinsValue()">
<a-icon type="minus" />
</a-button>
<a-button @click="changePlusValue(1)">
<a-icon type="plus" />
</a-button>
2017-11-16 10:29:02 +00:00
<br/>
2018-01-23 10:55:39 +00:00
<a-badge :dot="isShow">
2017-11-16 10:29:02 +00:00
<a href="#" class="head-example" />
2018-01-23 10:55:39 +00:00
</a-badge>
<a-button @click="changeShow()">toggle</a-button>
2017-11-16 10:29:02 +00:00
</div>
<br />
</div>
</template>
<script>
2017-12-28 10:46:31 +00:00
let i = 0
2017-11-16 10:29:02 +00:00
export default {
data () {
return {
currentStatus: 'warning',
2017-12-28 10:46:31 +00:00
count: 3,
2017-11-16 10:29:02 +00:00
isShow: true,
}
},
methods: {
changeStatus () {
this.currentStatus = 'processing'
},
2017-12-28 10:46:31 +00:00
changeMinsValue () {
i++
console.dir(i)
let count = this.count - 1
if (count < 0) {
count = 0
}
this.count = count
},
changePlusValue () {
2018-01-15 02:52:16 +00:00
// setInterval(() => {
// const count = this.count + 1
// this.count = count
// }, 300)
const count = this.count + 1
this.count = count
2017-11-16 10:29:02 +00:00
},
changeShow () {
this.isShow = !this.isShow
},
},
}
</script>
<style scoped>
.head-example {
width: 42px;
height: 42px;
2018-01-16 03:13:22 +00:00
border-radius: 4px;
2017-11-16 10:29:02 +00:00
background: #eee;
display: inline-block;
}
2017-12-28 10:46:31 +00:00
.ant-badge{
margin-right: 20px;
}
2017-11-16 10:29:02 +00:00
</style>