Commit 88105e4b authored by 张九刚's avatar 张九刚

修改结构等同dsl

parent b9967f4b
{ {
"name": "psd-parse-web", "name": "psd-parse-web",
"version": "2.1.2", "version": "2.1.3",
"main": "src/index.js", "main": "src/index.js",
"module": "dist/index.es.js", "module": "dist/index.es.js",
"license": "MIT", "license": "MIT",
......
...@@ -60,20 +60,20 @@ ...@@ -60,20 +60,20 @@
console.warn(`${page.name}不合法,请保持设计稿根目录为全部文件夹形式`); console.warn(`${page.name}不合法,请保持设计稿根目录为全部文件夹形式`);
} else { } else {
const { x, y, width, height } = page; const { x, y, width, height } = page;
console.log("当前选择的mode::", mode);
//如果没有选择适配的情况下,不设置页面的属性,方便给予节点相对布局 //如果没有选择适配的情况下,不设置页面的属性,方便给予节点相对布局
let styleObj = mode == 'none' ? {} : { width, height, ...getPageStyle(mode, x, y) }; let styleObj = mode == 'none' ? {} : { width, height, ...getPageStyle(mode, x, y) };
let viewNode = { let viewNode = {
name: folderName, name: folderName,
nodeType: 'Div', nodeType: 'Div',
properties: { properties: {
attrs: {},
props:{
className: `${folderName}`
},
expression:{},
style: { style: {
...styleObj ...styleObj
}, }
attrs: {
},
className: ""
}, },
uuid: generateUUID(), uuid: generateUUID(),
children: [] children: []
...@@ -89,15 +89,18 @@ ...@@ -89,15 +89,18 @@
const { x, y, width, height, origin: { layer, layer: { typeTool, solidColor } } } = node; const { x, y, width, height, origin: { layer, layer: { typeTool, solidColor } } } = node;
const layout = getXYBySign(name, x, y, width, height, mode); const layout = getXYBySign(name, x, y, width, height, mode);
console.log('layout::', layout);
let properties = { let properties = {
attrs: {},
props:{
className: `${name}`
},
expression:{},
style: { style: {
width, height, ...layout width, height, ...layout
}, },
attrs: { attrs: {
}, }
className: ""
}; };
let viewNode = { let viewNode = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment