[Doc] rename component README file (#3662)

This commit is contained in:
neverland
2019-06-27 14:22:40 +08:00
committed by GitHub
parent a56f96c246
commit ddb24e6762
119 changed files with 4 additions and 3 deletions
+69
View File
@@ -0,0 +1,69 @@
# 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;
}
}
};
```
## API
### Sidebar Props
| Attribute | Description | Type | Default |
|------|------|------|------|
| active-key | Index of chosen item | `String | Number` | `0` |
### Sidebar Events
| Event | Description | Arguments |
|------|------|------|
| change | Triggered when item changed | key: index of current item |
### SidebarItem Props
| Attribute | Description | Type | Default |
|------|------|------|------|
| title | Content | `String` | `''` |
| info | Info Message | `String | Number` | `''` |
| url | Link | `String` | - |
### SidebarItem Events
| Event | Description | Arguments |
|------|------|------|
| click | Triggered when click item | key: index of current item |