-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tabbar): add prop before-switch (#3060)
- Loading branch information
Showing
14 changed files
with
236 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/nutui-taro-demo/src/nav/pages/tabbar/before-switch.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<nut-tabbar v-model="active" :before-switch="beforeSwitch"> | ||
<nut-tabbar-item tab-title="Home"> | ||
<template #icon> | ||
<Home></Home> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="Category"> | ||
<template #icon> | ||
<Category></Category> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="Find"> | ||
<template #icon> | ||
<Find></Find> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="Cart"> | ||
<template #icon> | ||
<Cart></Cart> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="My"> | ||
<template #icon> | ||
<My></My> | ||
</template> | ||
</nut-tabbar-item> | ||
</nut-tabbar> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue' | ||
import { Home, Category, Find, Cart, My } from '@nutui/icons-vue-taro' | ||
const active = ref(0) | ||
const beforeSwitch = (_: any, index: string | number) => { | ||
console.log(index) | ||
return Number(index) % 2 === 0 | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/packages/__VUE/tabbar/__tests__/__snapshots__/index.spec.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<nut-tabbar v-model="active" :before-switch="beforeSwitch"> | ||
<nut-tabbar-item tab-title="Home"> | ||
<template #icon> | ||
<Home></Home> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="Category"> | ||
<template #icon> | ||
<Category></Category> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="Find"> | ||
<template #icon> | ||
<Find></Find> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="Cart"> | ||
<template #icon> | ||
<Cart></Cart> | ||
</template> | ||
</nut-tabbar-item> | ||
<nut-tabbar-item tab-title="My"> | ||
<template #icon> | ||
<My></My> | ||
</template> | ||
</nut-tabbar-item> | ||
</nut-tabbar> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue' | ||
import { Home, Category, Find, Cart, My } from '@nutui/icons-vue' | ||
const active = ref(0) | ||
const beforeSwitch = (_: any, index: string | number) => { | ||
console.log(index) | ||
return Number(index) % 2 === 0 | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.