mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
* fix: Tabbar icon line-height * [new feature] progress add showPivot prop * [new feature] TabItem support vue-router * [new feature] update document header style * [Doc] add toast english ducoment * [new feature] add i18n support * feat: Extract demos from markdown * feat: Base components demos * [new feature] complete demo extract & translate * [fix] text cases * fix: add deepAssign test cases * fix: changelog detail * [new feature] AddressEdit support i18n
51 lines
1.1 KiB
Markdown
51 lines
1.1 KiB
Markdown
## Badge
|
|
|
|
### Install
|
|
``` javascript
|
|
import { Badge } from 'vant';
|
|
|
|
Vue.component(Badge.name, Badge);
|
|
```
|
|
|
|
### Usage
|
|
|
|
#### Basic Usage
|
|
Use `activeKey` prop to set index of chosen 'badge'
|
|
|
|
```html
|
|
<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>
|
|
```
|
|
|
|
``` javascript
|
|
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` | - | - |
|