feat(Tabs): click-tab event add disabled param (#9042)

This commit is contained in:
neverland
2021-07-16 11:37:36 +08:00
committed by GitHub
parent 88c75970ad
commit 83cf4ebd33
5 changed files with 48 additions and 65 deletions
+4 -9
View File
@@ -24,7 +24,7 @@
</demo-block>
<demo-block :title="t('title3')">
<van-tabs @disabled="onClickDisabled">
<van-tabs>
<van-tab
v-for="index in 3"
:title="t('tab') + index"
@@ -45,7 +45,7 @@
</demo-block>
<demo-block :title="t('title5')">
<van-tabs @click="onClick">
<van-tabs @click-tab="onClickTab">
<van-tab v-for="index in 2" :title="t('tab') + index" :key="index">
{{ t('content') }} {{ index }}
</van-tab>
@@ -151,14 +151,10 @@ export default {
const tabs = [1, 2, 3, 4];
const onClick = (index: number, title: string) => {
const onClickTab = ({ title }: { title: string }) => {
Toast(title);
};
const onClickDisabled = (index: number, title: string) => {
Toast(title + t('disabled'));
};
const beforeChange = (name: number) => {
if (name === 1) {
return false;
@@ -172,9 +168,8 @@ export default {
...toRefs(state),
t,
tabs,
onClick,
onClickTab,
beforeChange,
onClickDisabled,
};
},
};