acdr-ui/dist/dev/mp-weixin/store/routers.js

58 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";
const common_vendor = require("../common/vendor.js");
const useRoutersStore = common_vendor.defineStore(
"routers",
() => {
const tabList = common_vendor.ref([
{
text: "首页",
iconPath: "/static/tabbar/home.png",
selectedIconPath: "/static/tabbar/homeL.png",
pagePath: "/pages/index/index"
},
{
iconPath: "/static/tabbar/space.png",
selectedIconPath: "/static/tabbar/spaceL.png",
pagePath: "/pages/space/index",
text: "互动空间"
},
{
iconPath: "/static/tabbar/24gl-paperPlane.png",
selectedIconPath: "/static/tabbar/24gl-paperPlaneL.png",
pagePath: "/pages/push/index",
text: "发布"
},
{
iconPath: "/static/tabbar/message.png",
selectedIconPath: "/static/tabbar/messageL.png",
pagePath: "/pages/message/index",
text: "消息"
},
{
iconPath: "/static/tabbar/my.png",
selectedIconPath: "/static/tabbar/myL.png",
pagePath: "/pages/my/index",
text: "我的"
}
]);
const selected = common_vendor.ref(0);
const currentTab = common_vendor.ref(tabList.value[0].pagePath);
const setCurrentTab = (pagePath) => {
currentTab.value = pagePath;
selected.value = getCurrentTabIndex.value;
};
const getCurrentTabIndex = common_vendor.computed(() => {
return tabList.value.findIndex((item) => item.pagePath === currentTab.value);
});
return {
tabList,
currentTab,
setCurrentTab,
selected
};
},
{ persist: true }
);
exports.useRoutersStore = useRoutersStore;
//# sourceMappingURL=routers.js.map