refactor: 自定义tabbar

This commit is contained in:
菲鸽
2024-05-11 09:36:26 +08:00
parent de8df540c2
commit ee52ae132d
6 changed files with 75 additions and 123 deletions

View File

@@ -1,42 +0,0 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useTabbarStore = defineStore(
'tabbar',
() => {
interface tabBarItem {
iconPath: string
selectedIconPath: string
pagePath: string
text: string
}
const tabBarList = ref<tabBarItem[]>([
{
iconPath: '/static/tabbar/home.png',
selectedIconPath: '/static/tabbar/homeHL.png',
pagePath: '/pages/index/index',
text: '首页',
},
{
iconPath: '/static/tabbar/example.png',
selectedIconPath: '/static/tabbar/exampleHL.png',
pagePath: '/pages/index/about',
text: '关于',
},
])
const tabIndex = ref(0)
const setTabIndex = (val: number) => {
tabIndex.value = val
}
return {
tabBarList,
tabIndex,
setTabIndex,
}
},
{
persist: true,
},
)