perf: 优化旧版浏览器页面恢复与资源加载
- 页面恢复时延后版本检查并补齐根背景,减少白闪与首帧卡顿 - 面向 Chrome 90 收敛公共分包,按需加载资源弹窗和知识库面板 - 压缩工作流图标并补充延迟加载与可见性生命周期测试
This commit is contained in:
@@ -29,7 +29,7 @@ import PluginToolIcon from '#/components/icons/PluginToolIcon.vue';
|
||||
import CardPage from '#/components/page/CardList.vue';
|
||||
import PageData from '#/components/page/PageData.vue';
|
||||
import PageSide from '#/components/page/PageSide.vue';
|
||||
import AddPluginModal from '#/views/ai/plugin/AddPluginModal.vue';
|
||||
import { createLazyComponentController } from '#/utils/lazy-component';
|
||||
|
||||
import { buildPluginPageQueryParams } from './plugin-query';
|
||||
import {
|
||||
@@ -61,6 +61,29 @@ interface CategoryFormData {
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface AddPluginModalInstance {
|
||||
openDialog: (row: Record<string, unknown>) => void;
|
||||
}
|
||||
|
||||
const {
|
||||
component: AddPluginModalComponent,
|
||||
componentRef: aiPluginModalRef,
|
||||
ensureInstance: ensureAddPluginModal,
|
||||
loading: pluginModalLoading,
|
||||
} = createLazyComponentController<AddPluginModalInstance>(
|
||||
() => import('#/views/ai/plugin/AddPluginModal.vue'),
|
||||
);
|
||||
|
||||
async function openPluginDialog(row: Record<string, unknown>) {
|
||||
try {
|
||||
const modal = await ensureAddPluginModal();
|
||||
modal.openDialog(row);
|
||||
} catch (error) {
|
||||
console.error('Failed to load plugin modal:', error);
|
||||
ElMessage.error($t('message.getDataError'));
|
||||
}
|
||||
}
|
||||
|
||||
function resolveNavTitle(item: PluginRecord) {
|
||||
return (item.title as string) || (item.name as string) || '';
|
||||
}
|
||||
@@ -93,7 +116,7 @@ const actions: ActionButton[] = [
|
||||
permission: '/api/v1/plugin/save',
|
||||
placement: 'inline',
|
||||
onClick(item) {
|
||||
aiPluginModalRef.value.openDialog(item);
|
||||
void openPluginDialog(item);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -194,7 +217,6 @@ const handleDelete = (item: PluginRecord) => {
|
||||
};
|
||||
|
||||
const pageDataRef = ref();
|
||||
const aiPluginModalRef = ref();
|
||||
const headerButtons = [
|
||||
{
|
||||
key: 'add',
|
||||
@@ -221,7 +243,7 @@ const handleSubmit = () => {
|
||||
const handleButtonClick = (event: HeaderActionEvent, _item: unknown) => {
|
||||
switch (event.key) {
|
||||
case 'add': {
|
||||
aiPluginModalRef.value.openDialog({});
|
||||
void openPluginDialog({});
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -316,7 +338,7 @@ const handleClickCategory = (item: PluginCategory) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="knowledge-container">
|
||||
<div v-loading="pluginModalLoading" class="knowledge-container">
|
||||
<div class="knowledge-header">
|
||||
<HeaderSearch
|
||||
:buttons="headerButtons"
|
||||
@@ -378,7 +400,12 @@ const handleClickCategory = (item: PluginCategory) => {
|
||||
</PageData>
|
||||
</div>
|
||||
</div>
|
||||
<AddPluginModal ref="aiPluginModalRef" @reload="reloadCurrentList" />
|
||||
<component
|
||||
:is="AddPluginModalComponent"
|
||||
v-if="AddPluginModalComponent"
|
||||
ref="aiPluginModalRef"
|
||||
@reload="reloadCurrentList"
|
||||
/>
|
||||
<EasyFlowFormModal
|
||||
:title="isEdit ? `${$t('button.edit')}` : `${$t('button.add')}`"
|
||||
v-model:open="dialogVisible"
|
||||
|
||||
Reference in New Issue
Block a user