fix: blank pageBoard bug

This commit is contained in:
ShawnPhang 2024-05-06 12:10:59 +08:00
parent 73c0f922b6
commit 6bf18d81cc
3 changed files with 20 additions and 9 deletions

View File

@ -3,7 +3,7 @@
* @Date: 2024-04-05 06:23:23
* @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-04-16 12:13:54
* @LastEditTime: 2024-05-06 11:59:28
*/
export type TScreeData = {
/** 记录编辑界面的宽度 */
@ -53,7 +53,7 @@ export type TStoreAction = {
value: TPageState[T]
pushHistory?: boolean
}): void
getDPage(data: TPageState): void
getDPage(data: TPageState): () => TPageState
/** 设置dPage */
setDPage(data: TPageState): void
/** 更新 Page从layouts获取*/

View File

@ -4,7 +4,7 @@
* @Date: 2024-03-18 21:00:00
* @Description:
* @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-04-18 15:02:09
* @LastEditTime: 2024-05-06 12:05:02
*/
import { Store, defineStore } from 'pinia'
@ -32,10 +32,10 @@ const CanvasStore = defineStore<"canvasStore", TCanvasState, {}, TStoreAction>("
dPage: pageDefault
}),
getters: {
getDPage() {
const widgetStore = useWidgetStore()
return widgetStore.dLayouts[this.dCurrentPage].global
},
// getDPage() {
// const widgetStore = useWidgetStore()
// return widgetStore.dLayouts[this.dCurrentPage].global
// },
},
actions: {
/** 更新画布缩放百分比 */
@ -67,6 +67,11 @@ const CanvasStore = defineStore<"canvasStore", TCanvasState, {}, TStoreAction>("
data[key] = value
}
},
/** 获取 Page */
getDPage() {
const widgetStore = useWidgetStore()
return widgetStore.dLayouts[this.dCurrentPage].global
},
/** 设置 Page */
setDPage(data: TPageState) {
this.dPage = data

View File

@ -3,7 +3,7 @@
* @Date: 2022-01-12 11:26:53
* @Description: 顶部操作按钮组
* @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2024-04-19 11:22:40
* @LastEditTime: 2024-05-06 12:07:43
-->
<template>
<div class="top-title"><el-input v-model="state.title" placeholder="未命名的设计" class="input-wrap" /></div>
@ -204,6 +204,7 @@ async function load(cb: () => void) {
wh[1] && (dPage.value.height = wh[1])
}
if (!id && !tempId) {
initBoard()
cb()
return
}
@ -226,13 +227,18 @@ async function load(cb: () => void) {
widgetStore.dLayouts = [{global: data.page, layers: data.widgets}]
id ? widgetStore.setDWidgets(widgetStore.getWidgets()) : widgetStore.setTemplate(widgetStore.getWidgets())
}
pageStore.setDPage(pageStore.getDPage)
pageStore.setDPage(pageStore.getDPage())
// id ? widgetStore.setDWidgets(data.widgets) : widgetStore.setTemplate(data.widgets)
}
cb()
historyStore.pushHistory('请求加载load')
}
function initBoard() {
widgetStore.setDWidgets(widgetStore.getWidgets())
pageStore.setDPage(pageStore.getDPage())
}
function draw() {
return new Promise<string>((resolve) => {
if (!canvasImage.value) resolve('')