fix: formUuid 可能不在 url 中

This commit is contained in:
力皓 2020-08-19 10:53:07 +08:00
parent d936d2bdde
commit 8657ab8318
2 changed files with 3 additions and 21 deletions

View File

@ -2,7 +2,6 @@ import { RootSchema } from '@ali/lowcode-types';
import { DocumentModel } from '@ali/lowcode-designer';
import { designer } from './editor';
import NodeCacheVisitor from './rootNodeVisitor';
import { getFormUuid } from './util';
const { project } = designer;
@ -52,7 +51,8 @@ const pages = Object.assign(project, {
project.load({
version: '1.0.0',
componentsMap: [],
componentsTree
componentsTree,
id: pages[0].id,
}, true);
// FIXME: 根本原因应该是 propStash 导致的,这样可以避免页面加载之后就被标记为 isModified
@ -89,7 +89,7 @@ const pages = Object.assign(project, {
if (!project.currentDocument) {
return null;
}
const currentPage = { ...project.currentDocument, id: getFormUuid() };
const currentPage = { ...project.currentDocument, id: project.getSchema().id };
Object.setPrototypeOf(currentPage, Object.getPrototypeOf(project.currentDocument || {}));
return currentPage;
},

View File

@ -1,18 +0,0 @@
function getUrlParameter(sParam: string) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
}
}
};
export function getFormUuid() {
return getUrlParameter('formUuid');
}