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