feat: 优化tabbar,精简tabbar
This commit is contained in:
@@ -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 }) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user