1
0
mirror of https://github.com/sahadev/vue-component-creater-ui.git synced 2025-12-18 08:24:15 +08:00

update: 支持全屏预览

This commit is contained in:
shangbin
2021-12-08 20:19:41 +08:00
parent b870e28608
commit 0363ba208a
3 changed files with 56 additions and 12 deletions

View File

@@ -66,15 +66,20 @@ export class MainPanelProvider {
const componentOptions = (new Function(`return ${newScript}`))();
componentOptions.template = template.content;
// 渲染当前代码
createBaseApp(componentOptions).mount(readyForMoutedElement);
// 拍平数据结构
this.editMode && this.flatDataStructure(rawDataStructure);
// 开启编辑模式
this.editMode && this.enableEditMode();
if (this.editMode) {
// 渲染当前代码
createBaseApp(componentOptions).mount(readyForMoutedElement);
// 拍平数据结构
this.flatDataStructure(rawDataStructure);
// 开启编辑模式
this.enableEditMode();
} else {
// 渲染当前代码
createBaseApp(componentOptions).mount(this.mountedEle);
}
return this;
}
@@ -88,8 +93,9 @@ export class MainPanelProvider {
return this;
}
setEditMode(editMode) {
setEditMode(editMode, mountedEle) {
this.editMode = editMode;
this.mountedEle = mountedEle;
this.reRender();
}
@@ -117,6 +123,7 @@ export class MainPanelProvider {
createMountedElement() {
const renderControlPanel = this.getControlPanelRoot();
const child = document.createElement('div');
child.style = "background-color: white;"
// 清空子节点
while (renderControlPanel.firstChild) {
@@ -253,6 +260,7 @@ export class MainPanelProvider {
* 开启编辑模式,并禁用默认的事件,添加编辑事件
*/
enableEditMode() {
debugger
const renderControlPanel = this.getControlPanelRoot();
// 加一个延迟的作用是给el-table这种绘制需要时间的组件留出充足的时间否则会造成el-table渲染不到页面上
setTimeout(() => {