mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
1.1 KiB
1.1 KiB
Badge
Install
import { Badge } from 'vant';
Vue.use(Badge);
Usage
Basic Usage
Use activeKey
prop to set index of chosen 'badge'
<van-badge-group :activeKey="activeKey">
<van-badge title="Title" @click="onClick"></van-badge>
<van-badge title="Title" @click="onClick" info="8"></van-badge>
<van-badge title="Title" @click="onClick" info="99"></van-badge>
<van-badge title="Title" @click="onClick" info="199"></van-badge>
</van-badge-group>
export default {
data() {
return {
activeKey: 0
};
},
methods: {
onClick(key) {
this.activeKey = key;
}
}
};
BadgeGroup API
Attribute | Description | Type | Default | Accepted Values |
---|---|---|---|---|
activeKey | Index of chosen badge | `String | Number` | 0 |
Badge API
Attribute | Description | Type | Default | Accepted Values |
---|---|---|---|---|
title | Content | String |
'' |
- |
info | Info Message | String |
'' |
- |
url | Link | String |
- | - |