| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <script lang="ts" setup>
- const router = useRouter()
- const route = useRoute()
- const { opcity } = storeToRefs(useSysStore())
- const { activeTabbar, getTabbarItemValue, setTabbarItemActive, tabbarList } = useTabbar()
- function handleTabbarChange({ value }: { value: string }) {
- setTabbarItemActive(value)
- router.pushTab({ name: value })
- }
- onMounted(() => {
- // #ifdef APP-PLUS
- uni.hideTabBar()
- // #endif
- nextTick(() => {
- if (route.name && route.name !== activeTabbar.value.name) {
- setTabbarItemActive(route.name)
- }
- })
- })
- function handleClick() {
- uni.pageScrollTo({
- duration: 50,
- scrollTop: 0,
- })
- }
- </script>
- <script lang="ts">
- export default {
- options: {
- addGlobalClass: true,
- virtualHost: true,
- styleIsolation: 'shared',
- },
- }
- </script>
- <template>
- <slot />
- <view class="page-tab">
- <wd-tabbar
- :model-value="activeTabbar.name" safe-area-inset-bottom placeholder fixed :bordered="false"
- custom-class="custom-tab" :custom-style="`box-shadow:${activeTabbar.name == 'smqjh-cart' ? '' : ' 0rpx -6rpx 12rpx 2rpx rgba(0, 0, 0, 0.09)'}`"
- @change="handleTabbarChange"
- >
- <wd-tabbar-item
- v-for="(item, index) in tabbarList" :key="index" :name="item.name"
- :value="getTabbarItemValue(item.name)" :title="index == 0 && item.active ? '' : item.title"
- >
- <template #icon="{ active }">
- <template v-if="index == 0 && !active">
- <i class="iconfont text-44rpx"></i>
- </template>
- <template v-else-if="index == 0 && active">
- <i v-if="opcity == 1" class="iconfont text-76rpx text-[var(--them-color)]" @click="handleClick"></i>
- <i v-else class="iconfont text-76rpx text-[var(--them-color)]"></i>
- </template>
- <template v-else-if="index != 0">
- <text :class="[active ? 'text-[var(--them-color)]' : '']" class="iconfont text-44rpx">
- {{ item.icon1 }}
- </text>
- </template>
- </template>
- </wd-tabbar-item>
- </wd-tabbar>
- </view>
- </template>
- <style scoped lang="scss">
- .page-tab {
- :deep() {
- .custom-tab {
- border-radius: 28rpx 28rpx 0 0;
- }
- }
- }
- </style>
|