Skip to content

Commit c702f7b

Browse files
committed
chore(vue editor): 更新vue editor 预览样式
1 parent cd25455 commit c702f7b

File tree

16 files changed

+112
-137
lines changed

16 files changed

+112
-137
lines changed

packages/demo/src/_common/components/component-with-dialog/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default ({
106106
return h('el-dialog', {
107107
on: {
108108
...this.curDialogListeners,
109-
'update:visible': function (val) {
109+
'update:visible': function update(val) {
110110
self.visible = val;
111111
}
112112
},

packages/demo/src/vue-editor/router/guards.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
// import beSyncUserState from './guardsModule/beforeEachSyncUserState.js';
2-
// import bePublishSave from './guardsModule/beforeEachPublishSave.js';
3-
// import beRedirect from './guardsModule/beforeEachRedirect.js';
4-
5-
// 顺序执行
6-
const beListConfig = [
7-
// beSyncUserState, // 新开标签页时,同步用户状态信息
8-
// bePublishSave, // 发布保存提示框
9-
// beRedirect // 分析用户状态,重定向落地页
10-
];
1+
const beListConfig = [];
112

123
// 路由守卫
134
export default function guards(router) {
@@ -43,7 +34,7 @@ export default function guards(router) {
4334

4435
// after each 不用改变路由行为,不采用上述模式
4536
router.afterEach((to, from) => {
46-
const baseTitle = 'Demo';
37+
const baseTitle = 'vue-json-schema-form';
4738
document.title = to.meta.title ? `${to.meta.title} | ${baseTitle}` : baseTitle;
4839
});
4940
}

packages/demo/src/vue-editor/router/guardsModule/beforeEachPublishSave.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/demo/src/vue-editor/router/guardsModule/beforeEachRedirect.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

packages/demo/src/vue-editor/router/guardsModule/beforeEachSyncUserState.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/demo/src/vue-editor/router/routes/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const routes = [
33
path: '/editor',
44
name: 'editor',
55
meta: {
6-
title: 'editor'
6+
title: 'Vue Editor'
77
},
88
component: () => import('../../views/editor/Editor.vue'),
99
},

packages/demo/src/vue-editor/views/editor/Editor.vue

Lines changed: 55 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
<template>
2-
<div v-loading="loading" :class="$style.box">
2+
<div v-loading="loading" :class="{
3+
[$style.box]: true,
4+
[$style.previewBox]: isPreview
5+
}"
6+
>
37
<transition name="el-zoom-in-top">
48
<EditorHeader
59
v-if="!isPreview"
610
v-model="scale"
711
@onUpdateScale="fixComponentFormPosition"
8-
@onPreview="handlePreview"
12+
@onPreview="(scale = 100) && (isPreview = true)"
913
@onSave="handleSave"
1014
@onPublish="handlePublish"
1115
></EditorHeader>
1216
<el-button
1317
v-else
1418
type="primary"
1519
style="position: fixed;right: 20px;top: 20px;z-index: 5;"
16-
@click="isPreview = false;"
20+
@click="(scale = 65) && (isPreview = false)"
1721
>
1822
结束预览
1923
</el-button>
2024
</transition>
25+
2126
<div :class="[$style.container, showToolBar ? $style.hasTools : '']">
2227
<span :class="$style.leftCaret" @click="showToolBar = !showToolBar">
2328
<i class="el-icon-caret-right"></i>
@@ -30,6 +35,7 @@
3035
>
3136
</EditorToolBar>
3237
</div>
38+
3339
<div ref="domScrollWrap" :class="$style.contentWrap">
3440
<div :class="[$style.contentBox]">
3541
<div :class="$style.dragAreaWrap" :style="{transform: `scale(${scale/100})`}">
@@ -135,18 +141,6 @@
135141
},
136142
data() {
137143
return {
138-
dragOptions: {
139-
animation: 300,
140-
group: 'listComponentsGroup',
141-
disabled: false,
142-
ghostClass: this.$style.ghost,
143-
filter: this.$style.disabled,
144-
draggable: '.draggableItem',
145-
tag: 'div',
146-
swapThreshold: 0.3,
147-
// forceFallback: true
148-
// fallbackTolerance: 0
149-
},
150144
loading: false,
151145
isPreview: false,
152146
scale: 65,
@@ -158,6 +152,20 @@
158152
},
159153
160154
computed: {
155+
dragOptions() {
156+
return {
157+
animation: 300,
158+
group: 'listComponentsGroup',
159+
disabled: this.isPreview,
160+
ghostClass: this.$style.ghost,
161+
filter: this.$style.disabled,
162+
draggable: '.draggableItem',
163+
tag: 'div',
164+
swapThreshold: 0.3,
165+
// forceFallback: true
166+
// fallbackTolerance: 0
167+
};
168+
},
161169
// 头部、中间、底部各个list集合
162170
componentListGroup() {
163171
return [this.editHeaderComponentList, this.editComponentList, this.editFooterComponentList];
@@ -256,10 +264,6 @@
256264
}
257265
});
258266
},
259-
handlePreview() {
260-
this.isPreview = true;
261-
this.dragOptions.disabled = true;
262-
},
263267
handlePublish() {
264268
this.handleSave(true);
265269
},
@@ -416,7 +420,35 @@
416420
--tool-bar-width: 320px;
417421
--drag-area-width: 1920px;
418422
}
423+
/*预览模式 同步样式重置*/
424+
.previewBox {
425+
.toolsBar,.leftCaret {
426+
display: none;
427+
}
428+
.container {
429+
height: 100vh;
430+
padding-left: 0;
431+
}
432+
.contentWrap {
433+
overflow-x: hidden;
434+
}
435+
.contentBox, .dragAreaWrap{
436+
width: auto;
437+
}
438+
:global {
439+
.vueEditor_viewComponentBox {
440+
margin-left: 50%;
441+
transform: translate(-50%, 0);
442+
cursor: auto;
443+
box-shadow: none;
444+
&:hover, &:active{
445+
box-shadow: none;
446+
}
447+
}
448+
}
449+
}
419450
.container {
451+
position: relative;
420452
box-sizing: border-box;
421453
padding-left: 0;
422454
padding-top: 10px;
@@ -440,7 +472,7 @@
440472
height: 50px;
441473
background: var(--color-white);
442474
top: 50%;
443-
margin-top: -15px;
475+
margin-top: -25px;
444476
box-shadow: 0 0 4px 0 color(var(--color-black) a(0.1));
445477
transition: all ease 0.3s;
446478
border-radius: 0 10px 10px 0;
@@ -451,9 +483,9 @@
451483
}
452484
}
453485
.toolsBar {
454-
position: fixed;
486+
position: absolute;
455487
left: 0;
456-
top: var(--site-top-height);
488+
top: 10px;
457489
bottom: 0;
458490
background: var(--color-white);
459491
width: var(--tool-bar-width);
@@ -486,7 +518,7 @@
486518
.contentBox {
487519
position: relative;
488520
width: 2600px;
489-
height: 100%;
521+
min-height: 100%;
490522
}
491523
.dragAreaWrap {
492524
transform-origin: top center;
@@ -534,15 +566,6 @@
534566
}
535567
}
536568
}
537-
.module-name-tip {
538-
position: absolute;
539-
top: 0;
540-
right: 0;
541-
font-size: 22px;
542-
padding: 10px;
543-
background: rgba(0,0,0,0.8);
544-
color: #FFFFFF;
545-
}
546569
.emptyBox {
547570
min-height: 350px;
548571
display: flex;

packages/demo/src/vue-editor/views/editor/components/GoodsListView.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@
5050
position: absolute;
5151
top: 0;
5252
right: 0;
53-
font-size: 22px;
54-
padding: 10px;
53+
font-size: 16px;
54+
padding: 8px 15px;
55+
border-radius: 4px;
5556
background: rgba(0,0,0,0.8);
5657
color: #FFFFFF;
5758
z-index: 3;

packages/demo/src/vue-editor/views/editor/components/ViewComponentWrap.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
:visible-arrow="false"
66
:popper-class="$style.editFormpopper"
77
placement="right-start"
8+
:disabled="isPreview"
89
width="400"
910
class="js_viewComponentWrap viewComponentWrap"
1011
style="display: block;"
@@ -59,7 +60,8 @@
5960
:class="{
6061
[$style.viewBox]: true,
6162
[$style.active]: editorItem.isEdit,
62-
js_viewComponentBox: true
63+
js_viewComponentBox: true,
64+
vueEditor_viewComponentBox: true,
6365
}"
6466
:style="{
6567
width: editorItem.viewWidth || '1190px'

packages/demo/src/vue-editor/views/editor/viewComponents/CarouselImg/View.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
height="420px"
77
>
88
<el-carousel-item v-for="(item, index) in formData.imgList" :key="index" height="400px">
9-
<a :class="$style.imgitem" :href="item.imgLink">
9+
<a :class="$style.imgitem" :href="item.imgLink" target="_blank">
1010
<el-image
11+
class="hover-animation"
1112
:class="$style.imgitem_img"
1213
:src="item.imgUrl"
1314
:style="{

0 commit comments

Comments
 (0)