mirror of
https://github.com/youzan/vant.git
synced 2025-10-25 04:05:41 +00:00
[breaking change] Badge: rename to sidebar
This commit is contained in:
67
packages/sidebar/en-US.md
Normal file
67
packages/sidebar/en-US.md
Normal file
@@ -0,0 +1,67 @@
|
||||
## Sidebar
|
||||
|
||||
### Install
|
||||
|
||||
``` javascript
|
||||
import { Sidebar, SidebarItem } from 'vant';
|
||||
|
||||
Vue.use(Sidebar);
|
||||
Vue.use(SidebarItem);
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
#### Basic Usage
|
||||
|
||||
Use `active-key` prop to set index of chosen item
|
||||
|
||||
```html
|
||||
<van-sidebar :active-key="activeKey" @change="onChange">
|
||||
<van-sidebar-item title="Title" />
|
||||
<van-sidebar-item title="Title" info="8" />
|
||||
<van-sidebar-item title="Title" info="99" />
|
||||
<van-sidebar-item title="Title" info="99+" />
|
||||
</van-sidebar>
|
||||
```
|
||||
|
||||
``` javascript
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeKey: 0
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChange(key) {
|
||||
this.activeKey = key;
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### Sidebar API
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| active-key | Index of chosen item | `String | Number` | `0` |
|
||||
|
||||
### Sidebar Event
|
||||
|
||||
| Event | Description | Arguments |
|
||||
|------|------|------|
|
||||
| change | Triggered when item changed | key: index of current item |
|
||||
|
||||
### SidebarItem API
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| title | Content | `String` | `''` |
|
||||
| info | Info Message | `String | Number` | `''` |
|
||||
| url | Link | `String` | - |
|
||||
|
||||
### SidebarItem Event
|
||||
|
||||
| Event | Description | Arguments |
|
||||
|------|------|------|
|
||||
| click | Triggered when click item | key: index of current item |
|
||||
Reference in New Issue
Block a user