[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

@@ -33,7 +33,7 @@
</demo-block>
<demo-block :title="$t('title5')">
<van-tabs @click="handleTabClick">
<van-tabs @click="onClick">
<van-tab v-for="index in 4" :title="$t('tab') + index" :key="index">
{{ $t('content') }} {{ index }}
</van-tab>
@@ -80,7 +80,8 @@ export default {
title5: '点击事件',
title6: '粘性布局',
title7: '自定义标签',
title8: '滑动切换'
title8: '滑动切换',
disabled: ' 已被禁用'
},
'en-US': {
tab: 'Tab ',
@@ -91,7 +92,8 @@ export default {
title5: 'Click Event',
title6: 'Sticky',
title7: 'Custom Tab',
title8: 'Swipeable'
title8: 'Swipeable',
disabled: ' is disabled'
}
},
@@ -103,12 +105,12 @@ export default {
},
methods: {
onClickDisabled() {
Toast('Disabled!');
onClickDisabled(index, title) {
this.$toast(title + this.$t('disabled'));
},
handleTabClick(index) {
Toast(index);
onClick(index, title) {
this.$toast(title);
}
}
};