mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] Area: add change event (#1019)
This commit is contained in:
parent
072dc24656
commit
0087fcdf6c
@ -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 values,column index |
|
||||
|
||||
### Data Structure
|
||||
|
||||
|
@ -145,7 +145,7 @@ Picker events will pass different parameters according to the columns are single
|
||||
|-----------|-----------|-----------|
|
||||
| confirm | Triggered when click confirm button | Single column:current value,current index<br>Multiple columns:current values,current indexes |
|
||||
| cancel | Triggered when click cancel button | Single column:current value,current index<br>Multiple columns:current values,current indexes |
|
||||
| change | Triggered when current option changed | Single column:current value,current index<br>Multiple columns:current values,column index |
|
||||
| change | Triggered when current option changed | Single column:Picker instance, current value,current index<br>Multiple columns:Picker instance, current values,column index |
|
||||
|
||||
|
||||
### Data struct of columns
|
||||
|
@ -53,6 +53,7 @@ Vue.use(Area);
|
||||
| --- | --- | --- |
|
||||
| confirm | 点击右上方完成按钮 | 一个数组参数,具体格式看下方数据格式章节 |
|
||||
| cancel | 点击取消按钮时 | - |
|
||||
| change | 选项改变时触发 | Picker 实例,所有列选中值,当前列对应的索引 |
|
||||
|
||||
### 数据格式
|
||||
|
||||
|
@ -147,7 +147,7 @@ Picker 组件的事件会根据 columns 是单列或多列返回不同的参数
|
||||
|-----------|-----------|-----------|
|
||||
| confirm | 点击完成按钮时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,所有列选中值对应的索引 |
|
||||
| cancel | 点击取消按钮时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,所有列选中值对应的索引 |
|
||||
| change | 选项改变时触发 | 单列:选中值,选中值对应的索引<br>多列:所有列选中值,当前列对应的索引 |
|
||||
| change | 选项改变时触发 | 单列:Picker 实例,选中值,选中值对应的索引<br>多列:Picker 实例,所有列选中值,当前列对应的索引 |
|
||||
|
||||
|
||||
### Columns 数据结构
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user