优化网页标题为undefined的情况

main
刘妍 2025-03-13 15:19:42 +08:00
parent ab34d97288
commit c5dcc62c56
2 changed files with 9 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import {
base64toFile,
JSONStringify,
JSONParse,
setTitle,
} from '@/utils';
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
import {
@ -14,6 +15,7 @@ import {
ChartEditStoreEnum,
ProjectInfoEnum,
ChartEditStorage,
EditCanvasConfigEnum,
} from '@/store/modules/chartEditStore/chartEditStore.d';
import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore';
import { useSystemStore } from '@/store/modules/systemStore/systemStore';
@ -285,6 +287,8 @@ export const useSync = () => {
if (res.content) {
// 更新全局数据
await updateComponent(JSONParse(res.content));
chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.PROJECT_NAME, res.projectName);
setTitle(`预览-${res.projectName}`);
return;
} else {
chartEditStore.setProjectInfo(ProjectInfoEnum.PROJECT_ID, fetchRouteParamsLocation());

View File

@ -55,8 +55,11 @@
await getSessionStorageInfo();
const chartEditStore = useChartEditStore() as unknown as ChartEditStorageType;
setTitle(`预览-${chartEditStore.editCanvasConfig.projectName}`);
setTitle(
chartEditStore.editCanvasConfig.projectName
? `预览-${chartEditStore.editCanvasConfig.projectName}`
: '',
);
const previewRefStyle = computed(() => {
return {