Files
CNCEC_APP/pages/index/index.vue
T
2026-08-17 11:01:21 +08:00

85 lines
1.8 KiB
Vue

<template>
<view class="custom-wrap">
<u-transition :show="current === 0" name="slide-right">
<Board v-if="current === 0" />
</u-transition>
<!-- <u-transition :show="current === 1" name="slide-right">
<FunModule v-if="current === 1" />
</u-transition> -->
<u-transition :show="current === 1" name="slide-right">
<About v-if="current === 1" />
</u-transition>
<u-tabbar :hideTabBar="false" v-model="current" active-color="var(--u-type-primary)" mid-button-size="60" :list="list" :mid-button="false"></u-tabbar>
</view>
</template>
<script setup>
import { ref, watch } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { isLoggedIn, toast, router } from '@/utils';
onShow(() => {
if (!isLoggedIn()) {
toast.error('请先登录');
setTimeout(() => {
router.reLaunch('/pages/login/index');
}, 1500);
}
});
console.log(isLoggedIn(), '是否登录');
/* 加载TabBar组件
-------------------------------------------------------------*/
import Board from './board/index.vue';
import About from './about/index.vue';
import FunModule from './fun/index.vue';
// 定义响应式数据
const list = ref([
{
iconPath: 'home',
selectedIconPath: 'home-fill',
text: '首页',
isDot: false,
customIcon: false
},
// {
// iconPath: 'grid',
// selectedIconPath: 'grid-fill',
// text: '功能',
// midButton: true,
// customIcon: false
// },
{
iconPath: 'account',
selectedIconPath: 'account-fill',
text: '我的',
isDot: false,
customIcon: false
}
]);
const current = ref(0);
watch(current, (val) => {
switch (val) {
case 0:
uni.setNavigationBarTitle({
title: '首页'
});
break;
// case 1:
// uni.setNavigationBarTitle({
// title: '功能'
// });
// break;
case 1:
uni.setNavigationBarTitle({
title: '我的'
});
break;
}
});
</script>
<style lang="scss"></style>