jiangping
2023-08-21 2837bdd57f72e386bbf9a725e7b3a13e5eb9e930
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
    <div class="index">
        <!--    头部导航    -->
        <template v-if="env == 'H5'">
            <v-Header :pathList="pathLists">
                <template v-slot:title>{{ title }}</template>
            </v-Header>
        </template>
        <!--    主题内容    -->
        <div class="index_content" :style="store.state.type ? 'min-height: calc(100% - 64px)' : 'min-height: calc(100% - 108px)'">
            <router-view v-slot="{ Component }">
                <keep-alive>
                    <component :is="Component" :key="route.meta.name" v-if="route.meta.keepAlive" />
                </keep-alive>
                <component :is="Component" :key="route.meta.name" v-if="!route.meta.keepAlive" />
            </router-view>
        </div>
        <!--    底部导航栏    -->
        <v-TabBar></v-TabBar>
    </div>
</template>
 
<script setup lang="ts">
    import { getCurrentInstance, reactive, ref, onMounted, computed } from 'vue'
    import { watch } from 'vue'
    import { useStore } from "vuex"
    import { useRoute } from 'vue-router'
    const { proxy }: any = getCurrentInstance()
    import vTabBar from '@/components/common/TabBar.vue'
    import vHeader from '@/components/common/Header.vue'
 
    const store = useStore()
    const route = useRoute()
    const title = ref<string>('')
    const isShow = ref<boolean>(false)
    const pathLists = reactive<string[]>([ '/index', '/workbench', '/bulletinboard', '/my' ])
    const env = computed(() => store.state.env)
 
    onMounted(() => {
        isShow.value = proxy.$dd.env.platform === 'notInDingTalk';
    })
 
    watch(() => route.meta.title, (newsPath, oldPath): void => {
        title.value = newsPath as string
    }, { immediate: true })
</script>
 
<style lang="scss" scoped>
.index {
    width: 100%;
    height: 100%;
    .index_content {
        position: relative;
    }
}
</style>