feat: 优化tabbar,精简tabbar

This commit is contained in:
菲鸽
2024-05-28 11:33:15 +08:00
parent 01679809b8
commit a9d3eccad5
8 changed files with 24 additions and 89 deletions

View File

@@ -40,7 +40,7 @@
import { tabBar } from '@/pages.json'
import { tabbarStore } from './tabbar'
/** tabbarList 里面的 path 必须和 pages.config.ts 的页面路径一致 */
/** tabbarList 里面的 path pages.config.ts 得到 */
const tabbarList = tabBar.list.map((item) => ({ ...item, path: `/${item.pagePath}` }))
function selectTabBar({ value: index }: { value: number }) {

View File

@@ -1,20 +1,6 @@
export const tabbarList = [
{
path: '/pages/index/about',
icon: 'home',
isWotIcon: true,
title: '首页',
},
{
path: '/pages/index/index',
icon: 'i-carbon-user-avatar',
isWotIcon: false,
title: '我的',
},
]
/**
* tabbar 状态,增加 storageSync 保证刷新浏览器时在正确的 tabbar 页面
* 使用reactive简单状态而不是 pinia 全局状态
*/
export const tabbarStore = reactive({
curIdx: uni.getStorageSync('app-tabbar-index') || 0,