| 123456789101112131415161718192021222324252627282930313233343536 |
- <script setup>
- import TabBar from './components/TabBar.vue'
- import { useRoute } from 'vue-router'
- import { computed, onMounted } from 'vue'
- import { useStore } from 'vuex'
- const route = useRoute()
- const store = useStore()
- // 计算是否显示TabBar
- const showTabBar = computed(() => {
- // 在加载页面不显示TabBar
- const paths = ['/loading', '/', '/exhibition', '/collection', '/user', '/indexPage']
- return paths.includes(route.path)
- })
- // 从store获取isFrom值
- const isFrom = computed(() => store.getters.getIsFrom)
- // 组件挂载时从URL参数获取isFrom并存储到store
- onMounted(() => {
- const queryString = window.location.search
- const urlParams = new URLSearchParams(queryString)
- const isFromParam = urlParams.get('isFrom')
- store.dispatch('setIsFrom', isFromParam)
- })
- </script>
- <template>
- <RouterView :key="$route.fullPath" />
- <TabBar v-if="showTabBar && isFrom != 'weixin'" />
- </template>
- <style scoped>
- /* 全局样式可以在这里添加 */
- </style>
|