feat: init wechat
This commit is contained in:
49
frontend/wechat/src/layouts/MainLayout.vue
Normal file
49
frontend/wechat/src/layouts/MainLayout.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const activeTab = ref(0)
|
||||
|
||||
const tabs = [
|
||||
{ label: '列表', route: '/' },
|
||||
{ label: '已购买', route: '/purchased' },
|
||||
{ label: '我的', route: '/profile' }
|
||||
]
|
||||
|
||||
const switchTab = (index) => {
|
||||
activeTab.value = index
|
||||
router.push(tabs[index].route)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="layout">
|
||||
<div class="content">
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</div>
|
||||
|
||||
<TabMenu :model="tabs" :activeIndex="activeTab" @tab-change="switchTab" class="bottom-tabs" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.bottom-tabs {
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user