[Improvement] Tab: click event add title param (#761)

This commit is contained in:
neverland
2018-03-23 11:10:35 +08:00
committed by GitHub
parent 0521c75b9c
commit 8ed6c73528
13 changed files with 45 additions and 50 deletions

View File

@@ -109,4 +109,4 @@ export default {
| address | Address | `String` |
#### Area Data Structure
Please refer to [Area](#/en-US/component/area) component。
Please refer to [Area](#/en-US/area) component。

View File

@@ -1,4 +1,5 @@
## Area
The Picker component is usually used with [Popup](#/en-US/popup) Component.
### Install

View File

@@ -16,7 +16,7 @@
### Quickstart
See in [Quickstart](https://www.youzanyun.com/zanui/vant#/en-US/component/quickstart).
See in [Quickstart](https://www.youzanyun.com/zanui/vant#/en-US/quickstart).
### Contribution
@@ -29,7 +29,7 @@ Modern browsers and Android 4.0+, iOS 6+.
### Links
* [Feedback](https://github.com/youzan/vant/issues)
* [Changelog](https://www.youzanyun.com/zanui/vant#/en-US/component/changelog)
* [Changelog](https://www.youzanyun.com/zanui/vant#/en-US/changelog)
* [Weapp UI](https://github.com/youzan/zanui-weapp)
* [React UI](https://www.youzanyun.com/zanui/zent)
* [Vant Demo](https://github.com/youzan/vant-demo)

View File

@@ -1,5 +1,5 @@
## PasswordInput
The PasswordInput component is usually used with [NumberKeyboard](#/en-US/component/number-keyboard) Component.
The PasswordInput component is usually used with [NumberKeyboard](#/en-US/number-keyboard) Component.
### Install
``` javascript

View File

@@ -1,4 +1,5 @@
## Picker
The Picker component is usually used with [Popup](#/en-US/popup) Component.
### Install
``` javascript

View File

@@ -1,4 +1,4 @@
## Tabs
## Tab
### Install
``` javascript
@@ -58,8 +58,8 @@ You can set `disabled` attribute on the corresponding `van-tab`.
```javascript
export default {
methods: {
onClickDisabled() {
Toast('Disabled!');
onClickDisabled(index, title) {
this.$toast(title + ' is disabled');
}
}
};
@@ -79,10 +79,8 @@ Tabs styled as cards.
#### Click Event
You can bind `click` event on `van-tabs`, the event handler function has one parameters: index of click tab.
```html
<van-tabs @click="handleTabClick">
<van-tabs @click="onClick">
<van-tab v-for="index in 4" :title="'tab' + index">
content of tab {{ index }}
</van-tab>
@@ -92,8 +90,8 @@ You can bind `click` event on `van-tabs`, the event handler function has one par
```javascript
export default {
methods: {
handleTabClick(index) {
Toast(index);
onClick(index, title) {
this.$toast(title);
}
}
};
@@ -151,8 +149,8 @@ In swipeable mode, you can switch tabs with swipe gestrue in the content
| Attribute | Description | Type | Default | Accepted Values |
|-----------|-----------|-----------|-------------|-------------|
| title | Tab title | `String` | - | - |
| disabled | Whether disabled current tab | `Boolean` | `false` | - |
| title | Title | `String` | - | - |
| disabled | Whether to disable tab | `Boolean` | `false` | - |
### Tab Slot
@@ -165,6 +163,5 @@ In swipeable mode, you can switch tabs with swipe gestrue in the content
| Event | Description | Arguments |
|-----------|-----------|-----------|
| click | Triggered when click tab | indexindex of current tab |
| disabled | Triggered when click disabled tab | indexindex of current tab |
| click | Triggered when click tab | indexindex of current tabtitle: tab title |
| disabled | Triggered when click disabled tab | indexindex of current tab, title: tab title |

View File

@@ -1,4 +1,5 @@
## Area 省市县选择组件
省市县选择组件通常与 [弹出层](#/zh-CN/popup) 组件配合使用
### 使用指南

View File

@@ -1,4 +1,5 @@
## Picker 选择器
选择器组件通常与 [弹出层](#/zh-CN/popup) 组件配合使用
### 使用指南
``` javascript

View File

@@ -1,4 +1,4 @@
## Tabs 标签页
## Tab 标签页
### 使用指南
``` javascript
@@ -58,8 +58,8 @@ export default {
```javascript
export default {
methods: {
onClickDisabled() {
Toast('Disabled!')
onClickDisabled(index, title) {
this.$toast(title + '已被禁用');
}
}
};
@@ -79,10 +79,10 @@ export default {
#### 点击事件
可以在`van-tabs`上绑定一个`click`事件,事件处理函数有一个参数,参数为对应`tab`在`tabs`中的索引。
可以在`van-tabs`上绑定`click`事件,事件传参为标签对应的索引和标题
```html
<van-tabs @click="handleTabClick">
<van-tabs @click="onClick">
<van-tab v-for="index in 4" :title="'选项 ' + index">
内容 {{ index }}
</van-tab>
@@ -92,8 +92,8 @@ export default {
```javascript
export default {
methods: {
handleTabClick(index) {
Toast(index);
onClick(index, title) {
this.$toast(title);
}
}
};
@@ -151,8 +151,8 @@ export default {
| 参数 | 说明 | 类型 | 默认值 | 可选 |
|-----------|-----------|-----------|-------------|-------------|
| title | tab的标题 | `String` | - | - |
| disabled | 是否禁用这个tab | `Boolean` | `false` | - |
| title | 标题 | `String` | - | - |
| disabled | 是否禁用标签 | `Boolean` | `false` | - |
### Tab Slot
@@ -165,6 +165,6 @@ export default {
| 事件名 | 说明 | 参数 |
|-----------|-----------|-----------|
| click | 某个tab点击事件 | index点击的`tab`的索引 |
| disabled | 某个tab禁用时点击事件 | index点击的`tab`的索引 |
| click | 点击标签时触发 | index标签索引title标题 |
| disabled | 点击被禁用的标签时触发 | index标签索引title标题 |