From b3d86647341547c52e73407fd63636989ef84562 Mon Sep 17 00:00:00 2001 From: 1549469775 <1549469775@qq.com> Date: Fri, 22 Jan 2021 14:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=A4=E9=94=80=E4=B8=8E=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/style/global.scss | 3 + src/data/component-list.js | 27 +++- src/main.js | 4 +- src/ui/detail/detail.vue | 26 +++- src/ui/editor/MakeLine.vue | 50 +++++--- src/ui/editor/Shape.vue | 289 ++++++++++++++++++++++++++++++++++++++++++- src/ui/editor/editor.vue | 118 ++++++++++++++++-- src/ui/header/header.vue | 34 ++++- src/ui/header/sub.vue | 17 +++ src/views/home/index.vue | 3 +- 10 files changed, 525 insertions(+), 46 deletions(-) create mode 100644 src/ui/header/sub.vue diff --git a/src/assets/style/global.scss b/src/assets/style/global.scss index 8a1a181..22ad855 100644 --- a/src/assets/style/global.scss +++ b/src/assets/style/global.scss @@ -1,3 +1,6 @@ html,body,#app{ height: 100%; +} +*{ + user-select: none; } \ No newline at end of file diff --git a/src/data/component-list.js b/src/data/component-list.js index 987c362..75155de 100644 --- a/src/data/component-list.js +++ b/src/data/component-list.js @@ -7,10 +7,29 @@ let list = [ props: {}, id: "customID", style: { + color: 'red', left: 0, top: 0, width: 80, height: 32, + zIndex: 1 + }, + }, + { + name: "img", + describe: "图片", + type: "component", + slot: [], + props: { + draggable:"false", + src: 'https://scpic.chinaz.net/files/pic/pic9/202101/bpic22299.jpg' + }, + id: "imgID", + style: { + left: 0, + top: 0, + width: 380, + height: 200, }, }, { @@ -34,7 +53,9 @@ let list = [ describe: "输入框", type: "component", slot: [], - props: {}, + props: { + placeholder:'请输入' + }, id: "inputID", style: { height: 32, @@ -126,5 +147,9 @@ let list = [ }, }, ]; +list = list.map(v=>{ + v.origin = JSON.parse(JSON.stringify(v.style)); + return v +}) export default list; diff --git a/src/main.js b/src/main.js index 70e6d83..69cfa58 100644 --- a/src/main.js +++ b/src/main.js @@ -13,12 +13,12 @@ Vue.config.productionTip = process.env.NODE_ENV === 'production' ? true : false; Vue.use(toast); -Vue.prototype.$computeStyle= function(style){ +Vue.prototype.$computeStyle= function(style,isDefault=false){ let myStyle = cloneDeep(style); let attr = ["left", "width", "height", "top", "right", "bottom"]; let attrStr = ["backgroundColor", "color","position",'zIndex']; Object.keys(style).forEach((v) => { - if (attr.indexOf(v) != -1 && typeof style[v] == "number") { + if (!isDefault&&attr.indexOf(v) != -1 && typeof style[v] == "number") { myStyle[v] = style[v] + "px"; } if (attrStr.indexOf(v) != -1) { diff --git a/src/ui/detail/detail.vue b/src/ui/detail/detail.vue index 59791ac..99886e9 100644 --- a/src/ui/detail/detail.vue +++ b/src/ui/detail/detail.vue @@ -3,13 +3,14 @@