[Improvement] Area: add change event (#1019)

This commit is contained in:
neverland 2018-05-08 20:54:36 +08:00 committed by GitHub
parent 072dc24656
commit 0087fcdf6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 3 deletions

View File

@ -55,6 +55,7 @@ Set `columns-num` with 2, you'll have a 2 level picker.
|-----------|-----------|-----------|
| confirm | triggers when clicking the confirm button | an array |
| cancel | triggers when clicking the cancel button | - |
| change | Triggered when current option changed | Picker instance, current valuescolumn index |
### Data Structure

View File

@ -145,7 +145,7 @@ Picker events will pass different parameters according to the columns are single
|-----------|-----------|-----------|
| confirm | Triggered when click confirm button | Single columncurrent valuecurrent index<br>Multiple columnscurrent valuescurrent indexes |
| cancel | Triggered when click cancel button | Single columncurrent valuecurrent index<br>Multiple columnscurrent valuescurrent indexes |
| change | Triggered when current option changed | Single columncurrent valuecurrent index<br>Multiple columnscurrent valuescolumn index |
| change | Triggered when current option changed | Single columnPicker instance, current valuecurrent index<br>Multiple columnsPicker instance, current valuescolumn index |
### Data struct of columns

View File

@ -53,6 +53,7 @@ Vue.use(Area);
| --- | --- | --- |
| confirm | 点击右上方完成按钮 | 一个数组参数,具体格式看下方数据格式章节 |
| cancel | 点击取消按钮时 | - |
| change | 选项改变时触发 | Picker 实例,所有列选中值,当前列对应的索引 |
### 数据格式

View File

@ -147,7 +147,7 @@ Picker 组件的事件会根据 columns 是单列或多列返回不同的参数
|-----------|-----------|-----------|
| confirm | 点击完成按钮时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,所有列选中值对应的索引 |
| cancel | 点击取消按钮时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,所有列选中值对应的索引 |
| change | 选项改变时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,当前列对应的索引 |
| change | 选项改变时触发 | 单列:Picker 实例,选中值,选中值对应的索引<br>多列:Picker 实例,所有列选中值,当前列对应的索引 |
### Columns 数据结构

View File

@ -1,7 +1,7 @@
<template>
<picker
:class="b()"
ref="picker"
:class="b()"
show-toolbar
value-key="name"
:title="title"
@ -156,6 +156,7 @@ export default create({
} else if (index === 1) {
picker.setColumnValues(2, this.getList('county', code.slice(0, 4)));
}
this.$emit('change', picker, values, index);
},
getValues() {