[Doc] TreeSelect: update doc

This commit is contained in:
陈嘉涵 2018-07-31 21:34:48 +08:00
parent d2c2c5c693
commit 7c7ab71ccd
4 changed files with 15 additions and 17 deletions

View File

@ -7,7 +7,7 @@ Page({
// 导航名称
text: '所有城市',
// 该导航下所有的可选项
children: [ ...config.pro1, ...config.pro2 ]
children: [...config.pro1, ...config.pro2]
}, {
// 导航名称
text: config.pro1Name,
@ -18,19 +18,17 @@ Page({
children: config.pro2
}
],
mainActiveIndex: 0,
activeId: 1002
},
handleNavClick({ detail = {} }) {
onNavClick({ detail = {} }) {
this.setData({
mainActiveIndex: detail.index || 0
});
},
handleItemClick({ detail = {} }) {
onItemClick({ detail = {} }) {
this.setData({
activeId: detail.id
});

View File

@ -1,6 +1,7 @@
{
"navigationBarTitleText": "Tree Select 分类选择",
"usingComponents": {
"demo-block": "../../components/demo-block/index",
"van-tree-select": "../../dist/tree-select/index"
}
}

View File

@ -1,9 +1,9 @@
<view style="margin-top: 5vh;">
<demo-block title="基础用法">
<van-tree-select
items="{{ items }}"
main-active-index="{{ mainActiveIndex }}"
active-id="{{ activeId }}"
bind:itemclick="handleItemClick"
bind:navclick="handleNavClick"
bind:itemclick="onItemClick"
bind:navclick="onNavClick"
></van-tree-select>
</view>
</demo-block>

View File

@ -1,12 +1,11 @@
## TreeSelect 分类选择
### 使用指南
在 index.json 中引入组件
```json
{
"usingComponents": {
"van-tree-select": "path/to/vant-weapp/dist/tree-select/index"
}
"usingComponents": {
"van-tree-select": "path/to/vant-weapp/dist/tree-select/index"
}
```
@ -17,8 +16,8 @@
items="{{ items }}"
main-active-index="{{ mainActiveIndex }}"
active-id="{{ activeId }}"
bind:navclick="handleNavClick"
bind:itemclick="handleItemClick"
bind:navclick="onNavClick"
bind:itemclick="onItemClick"
/>
```
```javascript
@ -27,13 +26,13 @@ Page({
// ...
},
handleNavClick({ detail = {} }) {
onNavClick({ detail = {} }) {
this.setData({
mainActiveIndex: detail.index || 0
});
},
handleItemClick({ detail = {} }) {
onItemClick({ detail = {} }) {
this.setData({
activeId: detail.id
});