From 8605e3d27132a8fa7da6b4e696411b21ec815888 Mon Sep 17 00:00:00 2001 From: hu0950 Date: Tue, 7 May 2019 14:31:19 +0800 Subject: [PATCH] docs(form fields): add input events (#468) * docs(checkbox and checkbox-group): add events * docs(components of form type): add input event documentation * docs(rate component): modify documents * docs(components of form type): modify events description * docs(input): modify events description --- document/components/docs/en-US/checkbox-group.md | 8 ++++++++ document/components/docs/en-US/checkbox.md | 8 +++++++- document/components/docs/en-US/input.md | 4 +++- document/components/docs/en-US/radio.md | 6 ++++++ document/components/docs/en-US/rate.md | 6 ++++++ document/components/docs/en-US/select.md | 3 ++- document/components/docs/en-US/switch.md | 6 ++++++ document/components/docs/en-US/textarea.md | 3 ++- document/components/docs/en-US/upload.md | 1 + document/components/docs/en-US/validator.md | 1 + document/components/docs/zh-CN/checkbox-group.md | 8 ++++++++ document/components/docs/zh-CN/checkbox.md | 8 +++++++- document/components/docs/zh-CN/input.md | 2 ++ document/components/docs/zh-CN/radio.md | 6 ++++++ document/components/docs/zh-CN/rate.md | 6 ++++++ document/components/docs/zh-CN/select.md | 1 + document/components/docs/zh-CN/switch.md | 6 ++++++ document/components/docs/zh-CN/textarea.md | 1 + document/components/docs/zh-CN/upload.md | 1 + document/components/docs/zh-CN/validator.md | 1 + 20 files changed, 81 insertions(+), 5 deletions(-) diff --git a/document/components/docs/en-US/checkbox-group.md b/document/components/docs/en-US/checkbox-group.md index 66273feb..f041361a 100644 --- a/document/components/docs/en-US/checkbox-group.md +++ b/document/components/docs/en-US/checkbox-group.md @@ -78,3 +78,11 @@ | disabled | whether disabled | Boolean | Note: each `options` item can be an string value, now both the`label` and `value` values are the string value. + +### Events + +| Event Name | Description | Parameter | +| - | - | - | +| checked | triggers when an checkbox in the checkboxGroup is checked | the currently checked checkbox value | +| cancel-checked | triggers when an checkbox in the checkboxGroup is unchecked | the currently unchecked checkbox value | +| input | triggers when the binding value changes | a set of the values of selected checkboxs | diff --git a/document/components/docs/en-US/checkbox.md b/document/components/docs/en-US/checkbox.md index 13f281be..5790a2d8 100644 --- a/document/components/docs/en-US/checkbox.md +++ b/document/components/docs/en-US/checkbox.md @@ -75,7 +75,7 @@ | Attribute | Description | Type | Accepted Values | Default | | - | - | - | - | - | -| option | option value | Boolean/String/Object | - | - | +| option | option value(if the value of option is a string type, the label and value will be this string you just set for option.) | Boolean/String/Object | - | - | | position | icon position | String | left/right | left | | shape | icon shape | String | circle/square | circle | | hollowStyle | whether is hollow-out style | Boolean | true/false | false | @@ -87,3 +87,9 @@ | label | the text of label | String | | value | the value of checkbox item | String/Number | | disabled | whether the checkbox item is disabled | Boolean | + +### Events + +| Event Name | Description | Parameter | +| - | - | - | +| input | triggers when the binding value changes | the updated value( if you set value in the option and the checkbox is checked, the value is option.value; otherwise, the value is the v-model value of checkbox )| diff --git a/document/components/docs/en-US/input.md b/document/components/docs/en-US/input.md index 31c3577e..99f24a9e 100644 --- a/document/components/docs/en-US/input.md +++ b/document/components/docs/en-US/input.md @@ -115,12 +115,14 @@ Input component. You can use the `v-model` directive to create two-way data bind | prepend | prepend content | | append | append content | -### Event +### Events | Event Name | Description | Parameters | | - | - | - | | focus | This event is triggered after the input box is focused. If input is disabled, it will not be triggered | e - event | | blur | This event is triggered after the input box blur | e - event | +| change | The event is triggered after the binding value is changed and the input box is blur | e - event | +| input | The event is triggered when the binding value is changed | The updated value | ### Instance methods diff --git a/document/components/docs/en-US/radio.md b/document/components/docs/en-US/radio.md index a65b894b..a646c251 100644 --- a/document/components/docs/en-US/radio.md +++ b/document/components/docs/en-US/radio.md @@ -166,3 +166,9 @@ Note: Each item of `options` can be an string, Which means both the `label` and | label | the text of label | String | | value | the value of radio item | String/Number | | disabled | whether the radio item is disabled | Boolean | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| input | triggers when the binding value changes | the value of the chosen radio | diff --git a/document/components/docs/en-US/rate.md b/document/components/docs/en-US/rate.md index d26cda09..32ea4017 100644 --- a/document/components/docs/en-US/rate.md +++ b/document/components/docs/en-US/rate.md @@ -99,3 +99,9 @@ Rate component. You can customize the rating star numbers, and disable the inter | Name | Description | Scope parameters | | - | - | - | | default | custom star element | - | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| input | The event triggers when the finger is removed from the rate item (this event will be not triggered when the disabled attribute is set) | The value of the rate item that is currently removed from | diff --git a/document/components/docs/en-US/select.md b/document/components/docs/en-US/select.md index 0edfcbfa..583f01d9 100644 --- a/document/components/docs/en-US/select.md +++ b/document/components/docs/en-US/select.md @@ -94,6 +94,7 @@ If an option is not an object, such as 2014,we will transform it to { value: 2 | Event Name | Description | Parameters 1 | Parameters 2 | Parameters 3 | | - | - | - | - | - | +| input | when the selected value changed by select | the selected value | - | - | | change | when the selected value changed by select | the selected value | the selected index | the selected text | | picker-show | when Picker show | - | - | - | -| picker-hide | when Picker hide | - | - | - | +| picker-hide | when Picker hide | - | - | - | \ No newline at end of file diff --git a/document/components/docs/en-US/switch.md b/document/components/docs/en-US/switch.md index 3ff46781..57c45be0 100644 --- a/document/components/docs/en-US/switch.md +++ b/document/components/docs/en-US/switch.md @@ -39,3 +39,9 @@ Switch usually used to switch the state of on/off. | - | - | - | - | - | | v-model | the state of on/off, two-way data binding | Boolean | true/false | false | | disabled | whether disabled | Boolean | true/false | false | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| input | triggers when the binding value changes | the updated value | diff --git a/document/components/docs/en-US/textarea.md b/document/components/docs/en-US/textarea.md index 1dbc2ee9..ebbb9d5c 100644 --- a/document/components/docs/en-US/textarea.md +++ b/document/components/docs/en-US/textarea.md @@ -104,12 +104,13 @@ Multi-line input box components. You can use the `v-model` directive to create t | remain | whether show the remaining count, if this value is `false` means show the textarea value length | Boolean | true/false | true | | negative | avaliable when `remain` is true, this value control whether allow remaining number is negative | Boolean | true/false | true | -### Event +### Events | Event Name | Description | Parameters | | - | - | - | | focus | This event is triggered after the textarea box is focused. If Textarea is disabled, it will not be triggered | e - event | | blur | This event is triggered after the textarea box blur | e - event | +| input | The event is triggered when the binding value changes | The updated value | ### Instance methods diff --git a/document/components/docs/en-US/upload.md b/document/components/docs/en-US/upload.md index 969a5b86..c9395ca0 100644 --- a/document/components/docs/en-US/upload.md +++ b/document/components/docs/en-US/upload.md @@ -221,6 +221,7 @@ A function with two parameters: `(file, next)`, the `file` is the original file | file-success | triggers when a file is uploaded successfully | the file object | | file-error | triggers when a file is failed to upload | the file object | | file-click | triggers when a file is clicked | the file object | +| input | triggers when the binding value(file list) changes | the updated value(file list) | ### Instance methods diff --git a/document/components/docs/en-US/validator.md b/document/components/docs/en-US/validator.md index c4137632..84ff9433 100644 --- a/document/components/docs/en-US/validator.md +++ b/document/components/docs/en-US/validator.md @@ -249,6 +249,7 @@ Validator is used to validate form data and corresponding warning message. | validating | validating (only triggered when async validateing) | - | | validated | validated (only triggered when async validateing) | valid: 校验是否成功 | | msg-click | click error message ele | - | +| input | triggers when the binding value changes | the updated value | ### Instance methods diff --git a/document/components/docs/zh-CN/checkbox-group.md b/document/components/docs/zh-CN/checkbox-group.md index a3111f63..aae8762a 100644 --- a/document/components/docs/zh-CN/checkbox-group.md +++ b/document/components/docs/zh-CN/checkbox-group.md @@ -76,3 +76,11 @@ | disabled | 复选框是否被禁用 | Boolean | 注:如果 `options` 中的项为字符串也是可以的,此时默认 `label` 和 `value` 的值都为该字符串的值。 + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| checked | 勾选复选框组中的某一项时触发 | 当前勾选的复选框值 | +| cancel-checked | 取消勾选复选框组中的某一项时触发 | 当前取消勾选的复选框值 | +| input | 当绑定值变化时触发 | 当前选中的复选框值的集合 | diff --git a/document/components/docs/zh-CN/checkbox.md b/document/components/docs/zh-CN/checkbox.md index 832c0fc6..7c60036d 100644 --- a/document/components/docs/zh-CN/checkbox.md +++ b/document/components/docs/zh-CN/checkbox.md @@ -73,7 +73,7 @@ | 参数 | 说明 | 类型 | 可选值 | 默认值 | | - | - | - | - | - | -| option | 配置项 | Boolean/String/Object | - | - | +| option | 配置项(如果 options 中的项为字符串,此时默认 label 和 value 的值都为该字符串的值) | Boolean/String/Object | - | - | | position | 位置 | String | left/right | left | | shape | 图标形状 | String | circle/square | circle | | hollowStyle | 是否是镂空样式的 | Boolean | true/false | false | @@ -85,3 +85,9 @@ | label | 复选框显示文字 | String | | value | 复选框的值 | String/Number | | disabled | 复选框是否被禁用 | Boolean | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| input | 当绑定值变化时触发 | 更新后的复选框的值(若option中设置了value,且勾选复选框时,该值为option.value;否则,该值为复选框的v-model值)| diff --git a/document/components/docs/zh-CN/input.md b/document/components/docs/zh-CN/input.md index dc59bae9..1c7228ff 100644 --- a/document/components/docs/zh-CN/input.md +++ b/document/components/docs/zh-CN/input.md @@ -122,6 +122,8 @@ | - | - | - | | focus | 输入框聚焦后触发此事件,如果禁用状态,则不触发 | e - 事件对象 | | blur | 输入框失焦后触发此事件 | e - 事件对象 | +| change | 绑定值改变且输入框失去焦点后触发 | e - 事件对象 | +| input | 绑定值变化时触发 | 更新后的绑定值 | ### 实例方法 diff --git a/document/components/docs/zh-CN/radio.md b/document/components/docs/zh-CN/radio.md index b41d3070..1249222b 100644 --- a/document/components/docs/zh-CN/radio.md +++ b/document/components/docs/zh-CN/radio.md @@ -166,3 +166,9 @@ | label | 单选框显示文字 | String | | value | 单选框的值 | String/Number | | disabled | 单选框是否被禁用 | Boolean | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| input | 绑定值变化时触发 | 选中的单选框value值 | diff --git a/document/components/docs/zh-CN/rate.md b/document/components/docs/zh-CN/rate.md index e3e4effc..a8c07a67 100644 --- a/document/components/docs/zh-CN/rate.md +++ b/document/components/docs/zh-CN/rate.md @@ -99,3 +99,9 @@ | 名字 | 说明 | 作用域参数 | | - | - | - | | default | 自定义星星元素 | - | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| input | 手指从 rate item 移开时触发(当设置了 disabled 属性时,该事件不触发) | 当前移开的 rate item 的值 | diff --git a/document/components/docs/zh-CN/select.md b/document/components/docs/zh-CN/select.md index 2f4fdb19..045db1ca 100644 --- a/document/components/docs/zh-CN/select.md +++ b/document/components/docs/zh-CN/select.md @@ -92,6 +92,7 @@ __注:__ 由于此组件依赖 [Picker](#/zh-CN/docs/picker) 组件,而 Pick | 事件名 | 说明 | 参数1 | 参数2 | 参数3 | | - | - | - | - | - | +| input | 在选择时,如果选择的值改变了派发 | 选中项的值 | - | - | | change | 在选择时,如果选择的值改变了派发 | 选中项的值 | 选中项的索引 | 选中项的文案 | | picker-show | 使用的 Picker 显示的时候派发 | - | - | - | | picker-hide | 使用的 Picker 隐藏的时候派发(确定或取消都会派发) | - | - | - | diff --git a/document/components/docs/zh-CN/switch.md b/document/components/docs/zh-CN/switch.md index ab96a868..e7ec4fcb 100644 --- a/document/components/docs/zh-CN/switch.md +++ b/document/components/docs/zh-CN/switch.md @@ -39,3 +39,9 @@ | - | - | - | - | - | | v-model | 开关状态,双向数据绑定 | Boolean | true/false | false | | disabled | 是否禁用 | Boolean | true/false | false | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| input | 绑定值变化时触发 | 更新后的绑定值 | diff --git a/document/components/docs/zh-CN/textarea.md b/document/components/docs/zh-CN/textarea.md index db4e2fa7..800e26da 100644 --- a/document/components/docs/zh-CN/textarea.md +++ b/document/components/docs/zh-CN/textarea.md @@ -101,6 +101,7 @@ | - | - | - | | focus | 输入框聚焦后触发此事件,如果禁用状态,则不触发 | e - 事件对象 | | blur | 输入框失焦后触发此事件 | e - 事件对象 | +| input | 绑定值变化时触发 | 更新后的绑定值 | ### 实例方法 diff --git a/document/components/docs/zh-CN/upload.md b/document/components/docs/zh-CN/upload.md index d88aa63a..36e4924a 100644 --- a/document/components/docs/zh-CN/upload.md +++ b/document/components/docs/zh-CN/upload.md @@ -227,6 +227,7 @@ | file-success | 文件上传成功后触发 | 文件对象 | | file-error | 文件上传失败后触发 | 文件对象 | | file-click | 文件点击后触发 | 文件对象 | +| input | 绑定值(文件列表)改变后触发 | 更新后的绑定值(文件列表) | ### 实例方法 diff --git a/document/components/docs/zh-CN/validator.md b/document/components/docs/zh-CN/validator.md index 27edede0..b2f7ce72 100644 --- a/document/components/docs/zh-CN/validator.md +++ b/document/components/docs/zh-CN/validator.md @@ -255,6 +255,7 @@ | validating | 正在校验(只在异步场景下触发) | - | | validated | 校验完成(只在异步场景下触发) | valid: 校验是否成功 | | msg-click | 错误消息点击 | - | +| input | 绑定值变化时触发 | 更新后的绑定值 | ### 实例方法 -- GitLab