1 line
2.9 KiB
Plaintext
1 line
2.9 KiB
Plaintext
{"version":3,"file":"routers.js","sources":["../../../../src/store/routers.js"],"sourcesContent":["import { defineStore } from 'pinia'\r\nimport { ref } from 'vue'\r\n\r\n// 定义路由的状态管理\r\nexport const useRoutersStore = defineStore(\r\n 'routers',\r\n () => {\r\n // 初始化 tabList 数据\r\n const tabList = ref([\r\n {\r\n text: '首页',\r\n iconPath: '/static/tabbar/home.png',\r\n selectedIconPath: '/static/tabbar/homeL.png',\r\n pagePath: '/pages/index/index',\r\n },\r\n {\r\n iconPath: '/static/tabbar/space.png',\r\n selectedIconPath: '/static/tabbar/spaceL.png',\r\n pagePath: '/pages/space/index',\r\n text: '互动空间',\r\n },\r\n {\r\n iconPath: '/static/tabbar/24gl-paperPlane.png',\r\n selectedIconPath: '/static/tabbar/24gl-paperPlaneL.png',\r\n pagePath: '/pages/push/index',\r\n text: '发布',\r\n },\r\n {\r\n iconPath: '/static/tabbar/message.png',\r\n selectedIconPath: '/static/tabbar/messageL.png',\r\n pagePath: '/pages/message/index',\r\n text: '消息',\r\n },\r\n {\r\n iconPath: '/static/tabbar/my.png',\r\n selectedIconPath: '/static/tabbar/myL.png',\r\n pagePath: '/pages/my/index',\r\n text: '我的',\r\n },\r\n ])\r\n\r\n // 当前选中的 tab\r\n const selected = ref(0)\r\n const currentTab = ref(tabList.value[0].pagePath)\r\n\r\n // 设置当前选中的 tab\r\n const setCurrentTab = (pagePath) => {\r\n currentTab.value = pagePath\r\n selected.value = getCurrentTabIndex.value\r\n }\r\n\r\n // 获取当前选中tab的index\r\n const getCurrentTabIndex = computed(() => {\r\n return tabList.value.findIndex((item) => item.pagePath === currentTab.value)\r\n })\r\n\r\n // 返回状态和方法\r\n return {\r\n tabList,\r\n currentTab,\r\n setCurrentTab,\r\n selected,\r\n }\r\n },\r\n { persist: true },\r\n)\r\n"],"names":["defineStore","ref","computed"],"mappings":";;AAIY,MAAC,kBAAkBA,cAAW;AAAA,EACxC;AAAA,EACA,MAAM;AAEJ,UAAM,UAAUC,cAAAA,IAAI;AAAA,MAClB;AAAA,QACE,MAAM;AAAA,QACN,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,UAAU;AAAA,MACX;AAAA,MACD;AAAA,QACE,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,UAAU;AAAA,QACV,MAAM;AAAA,MACP;AAAA,MACD;AAAA,QACE,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,UAAU;AAAA,QACV,MAAM;AAAA,MACP;AAAA,MACD;AAAA,QACE,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,UAAU;AAAA,QACV,MAAM;AAAA,MACP;AAAA,MACD;AAAA,QACE,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,UAAU;AAAA,QACV,MAAM;AAAA,MACP;AAAA,IACP,CAAK;AAGD,UAAM,WAAWA,cAAG,IAAC,CAAC;AACtB,UAAM,aAAaA,cAAAA,IAAI,QAAQ,MAAM,CAAC,EAAE,QAAQ;AAGhD,UAAM,gBAAgB,CAAC,aAAa;AAClC,iBAAW,QAAQ;AACnB,eAAS,QAAQ,mBAAmB;AAAA,IACrC;AAGD,UAAM,qBAAqBC,cAAAA,SAAS,MAAM;AACxC,aAAO,QAAQ,MAAM,UAAU,CAAC,SAAS,KAAK,aAAa,WAAW,KAAK;AAAA,IACjF,CAAK;AAGD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACF;AAAA,EACD,EAAE,SAAS,KAAM;AACnB;;"} |