Skip to content

Commit 89eead9

Browse files
committed
perf: 优化setSize组件和workspace插件宽高默认值问题
1 parent f96254e commit 89eead9

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/components/setSize.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!--
22
* @Author: 秦少卫
33
* @Date: 2022-09-03 19:16:55
4-
* @LastEditors: 秦少卫
5-
* @LastEditTime: 2024-10-07 17:25:24
4+
* @LastEditors: June
5+
* @LastEditTime: 2024-11-22 15:28:43
66
* @Description: 尺寸设置
77
-->
88

@@ -38,18 +38,16 @@ import modalSzie from '@/components/common/modalSzie';
3838
3939
const { isSelect, canvasEditor } = useSelect();
4040
41-
const DefaultSize = {
42-
width: 900,
43-
height: 1200,
44-
};
45-
4641
const modalSizeRef = ref(null);
4742
48-
let width = ref(DefaultSize.width);
49-
let height = ref(DefaultSize.height);
43+
const width = ref(0);
44+
const height = ref(0);
5045
5146
onMounted(() => {
52-
canvasEditor.setSize(width.value, height.value);
47+
const size = canvasEditor.getWorkspase();
48+
const { width: w, height: h } = size || {};
49+
width.value = w;
50+
height.value = h;
5351
canvasEditor.on('sizeChange', (w, h) => {
5452
width.value = w;
5553
height.value = h;

0 commit comments

Comments
 (0)