mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-uniapp
synced 2025-08-10 01:12:45 +08:00
38 lines
1.1 KiB
Vue
38 lines
1.1 KiB
Vue
<template>
|
|
<wd-tabbar
|
|
fixed
|
|
v-model="tabbarStore.curIdx"
|
|
bordered
|
|
safeAreaInsetBottom
|
|
placeholder
|
|
@change="selectTabBar"
|
|
>
|
|
<block v-for="(item, idx) in tabbarList" :key="item.path">
|
|
<!-- <wd-tabbar-item v-if="item.isUnocssIcon" :title="item.text">
|
|
<template #icon>
|
|
<view
|
|
h-40rpx
|
|
w-40rpx
|
|
:class="[item.icon, idx === tabbarStore.curIdx ? 'is-active' : 'is-inactive']"
|
|
></view>
|
|
</template>
|
|
</wd-tabbar-item> -->
|
|
<wd-tabbar-item :title="item.text" :icon="item.icon"></wd-tabbar-item>
|
|
</block>
|
|
</wd-tabbar>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { tabBar } from '@/pages.json'
|
|
import { tabbarStore } from './tabbar'
|
|
|
|
/** tabbarList 里面的 path 必须和 pages.config.ts 的页面路径一致 */
|
|
const tabbarList = tabBar.list.map((item) => ({ ...item, path: `/${item.pagePath}` }))
|
|
|
|
function selectTabBar({ value: index }: { value: number }) {
|
|
const url = tabbarList[index].path
|
|
tabbarStore.setCurIdx(index)
|
|
uni.switchTab({ url })
|
|
}
|
|
</script>
|