refactor(fg-tabbar): 使用工具函数中的tabBarList替代直接导入

从直接导入pages.json中的tabBar改为使用utils中封装的_tabBarList,提高代码复用性和维护性
This commit is contained in:
feige996 2025-06-03 12:38:13 +08:00
parent b857669c0c
commit 0042afe215

View File

@ -37,11 +37,11 @@
<script setup lang="ts"> <script setup lang="ts">
// unocss icon // unocss icon
// i-carbon-code // i-carbon-code
import { tabBar } from '@/pages.json' import { tabBarList as _tabBarList } from '@/utils/index'
import { tabbarStore } from './tabbar' import { tabbarStore } from './tabbar'
/** tabbarList 里面的 path 从 pages.config.ts 得到 */ /** tabbarList 里面的 path 从 pages.config.ts 得到 */
const tabbarList = tabBar.list.map((item) => ({ ...item, path: `/${item.pagePath}` })) const tabbarList = _tabBarList.map((item) => ({ ...item, path: `/${item.pagePath}` }))
function selectTabBar({ value: index }: { value: number }) { function selectTabBar({ value: index }: { value: number }) {
const url = tabbarList[index].path const url = tabbarList[index].path