feat: And surface switching loading optimization

This commit is contained in:
vben
2024-06-23 19:39:44 +08:00
parent 6afed34437
commit 24aab5b4bb
24 changed files with 596 additions and 1696 deletions

View File

@@ -22,17 +22,21 @@ function setupCommonGuard(router: Router) {
const loadedPaths = new Set<string>();
router.beforeEach(async (to) => {
to.meta.loaded = loadedPaths.has(to.path);
// 页面加载进度条
if (preferences.transition.progress) {
if (!to.meta.loaded && preferences.transition.progress) {
startProgress();
}
to.meta.loaded = loadedPaths.has(to.path);
return true;
});
router.afterEach((to) => {
// 记录页面是否加载,如果已经加载,后续的页面切换动画等效果不在重复执行
loadedPaths.add(to.path);
if (preferences.tabbar.enable) {
loadedPaths.add(to.path);
}
// 关闭页面加载进度条
if (preferences.transition.progress) {

View File

@@ -3,7 +3,7 @@
// import { echartsInstance as echarts } from '@vben/chart-ui';
defineOptions({ name: 'WelCome' });
defineOptions({ name: 'Welcome' });
// const cardList = ref([
// {
@@ -247,5 +247,4 @@ defineOptions({ name: 'WelCome' });
<template>
<div>dashboard</div>
<!-- <Dashboard :card-list="cardList" :chart-tabs="chartTabs" /> -->
</template>