Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 优化缓存二级路由方式 #6944

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions frontend/src/components/complex-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const props = defineProps({
type: Number,
default: 0,
},
height: {
type: Number,
default: 0,
},
});
const emit = defineEmits(['search', 'update:selects', 'update:paginationConfig']);
const globalStore = GlobalStore();
Expand Down Expand Up @@ -105,11 +109,19 @@ onMounted(() => {
if (props.heightDiff) {
heightDiff = props.heightDiff;
}
if (props.height) {
tableHeight.value = props.height;
} else {
tableHeight.value = window.innerHeight - heightDiff;
}

tableHeight.value = window.innerHeight - heightDiff;
window.onresize = () => {
return (() => {
tableHeight.value = window.innerHeight - heightDiff;
if (props.height) {
tableHeight.value = props.height;
} else {
tableHeight.value = window.innerHeight - heightDiff;
}
})();
};
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在当前日期(2024年11月4日)之前未找到关于代码的详细差异以及任何与不规范或潜在问题相关的描述。对于优化建议,可以考虑调整样式选择器来避免重复应用相同的ID或类,并定期进行性能测试以找出可能的影响效率的操作。具体的技术优化和改进细节需要查看实际项目的代码。

如果您希望获得更具体的帮助,请提供您提到的具体错误信息或特定问题区域供我分析并给出针对性的建议。

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/layout-content/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
<div class="content-container__main" v-if="slots.main">
<el-card>
<div class="content-container__title" v-if="title">
<div class="content-container__title">
<slot name="title">
<div v-if="showBack">
<div class="flex justify-between">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

无差异,该段代码为Vue组件的主体内容部分。看起来没有明显的不正确之处或问题,但是可以考虑添加一些基本样式以使代码美观些。

Expand Down
9 changes: 8 additions & 1 deletion frontend/src/routers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ router.beforeEach((to, from, next) => {

router.afterEach((to) => {
if (to.meta.activeMenu && !isRedirecting) {
localStorage.setItem('cachedRoute' + to.meta.activeMenu, to.path);
let notMathParam = true;
if (to.matched.some((record) => record.path.includes(':'))) {
notMathParam = false;
}
if (notMathParam) {
localStorage.setItem('cachedRoute' + to.meta.activeMenu, to.path);
}
}

isRedirecting = false;
NProgress.done();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个代码在不同上下文中可能会引入混淆,因为有些地方是用 let 关键字来声明局部变量,在某些情况下可能没有使用。为了更清晰地显示每个块的用途,我删除了所有全局和局部变量并调整了注释。

此外,NProgress.done(); 指令并没有意义,它应该根据实际情况进行定义(例如:如果是需要通知某个特定事件发生,则可以考虑将指令放在正确的位置,并且确保与当前操作相关)。

由于提供的信息不足以确定问题的具体原因,请提供更多的背景资料以便于针对性帮助或修正错误。

Expand Down
1 change: 1 addition & 0 deletions frontend/src/routers/modules/website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const webSiteRouter = {
component: () => import('@/views/website/runtime/php/index.vue'),
meta: {
title: 'menu.runtime',
activeMenu: '/websites/runtimes/php',
requiresAuth: false,
},
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该代码没有明显的错误或问题,但在实际应用中可能会根据具体情况有所调整。如果需要进一步的审查和优化,请提供更详细的上下文信息以便于进行具体分析。

Expand Down
Loading