liwei 1 year ago
parent
commit
2cdb9bcd9a
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/modules/editor/objects/DesignTemp/creates/createCompStyle.ts

+ 6 - 1
src/modules/editor/objects/DesignTemp/creates/createCompStyle.ts

@@ -72,7 +72,12 @@ export function createCompStyle(
 
  
     
-  
+  const [w, h, sizeOpts] = layout.size;
+
+  style.width = designToNaturalSize(w);
+  style.height = designToNaturalSize(h, {
+      adaptiveH: sizeOpts?.unit === "%",
+  });
 
   if (layout.transformMatrix) {
     //样式的scale转 width