tabs add click event

This commit is contained in:
cookfront
2017-03-30 14:27:49 +08:00
parent 09650d61ea
commit 969e1f78e1
6 changed files with 90 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
<style>
@component-namespace demo {
@b tab {
@@ -24,6 +25,10 @@ export default {
methods: {
popalert() {
alert('haha')
},
handleTabClick(index) {
alert(index);
}
}
};
@@ -43,9 +48,10 @@ export default {
<zan-tab title="选项五">内容五</zan-tab>
</zan-tabs>
```
:::
### 禁用用法
:::demo 禁用用法
```html
<zan-tabs :active="active">
@@ -68,6 +74,7 @@ export default {
:::
### card样式用法
:::demo card样式用法
```html
<zan-tabs type="card">
@@ -100,6 +107,7 @@ export default {
</style>
### 自定义样式用法
:::demo 自定义样式用法
```html
<zan-tabs active="2" navclass="custom-tabwrap">
@@ -131,6 +139,30 @@ export default {
```
:::
### click事件
:::demo click事件
```html
<zan-tabs @click="handleTabClick">
<zan-tab title="选项一">内容一</zan-tab>
<zan-tab title="选项二">内容二</zan-tab>
<zan-tab title="选项三">内容三</zan-tab>
<zan-tab title="选项四">内容四</zan-tab>
<zan-tab title="选项五">内容五</zan-tab>
</zan-tabs>
<script>
export default {
methods: {
handleTabClick(index) {
alert(index);
}
}
};
</script>
```
:::
### zan-tabs API
| 参数 | 说明 | 类型 | 默认值 | 可选 |