Editor.vue
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<script>
import Vue from 'vue'
import CoreEditor from '../components/core/editor/index.js'
import LbpButton from '../components/plugins/lbp-button'
import LbpPicture from '../components/plugins/lbp-picture'
import LbpText from '../components/plugins/lbp-text'
const PluginList = [
{
title: '文字',
icon: 'hand-pointer-o',
component: LbpText,
visible: true,
name: 'lbp-text',
children: [
{
title: '文字',
icon: 'hand-pointer-o',
component: LbpText,
visible: true,
name: 'lbp-text'
}
]
},
{
title: '按钮',
icon: 'hand-pointer-o',
component: LbpButton,
visible: true,
name: 'lbp-button',
children: [
{
title: '按钮',
icon: 'hand-pointer-o',
component: LbpButton,
visible: true,
name: 'lbp-button'
}
]
},
{
title: '图片',
icon: 'image',
component: LbpPicture,
visible: true,
name: 'lbp-picture',
children: [
{
title: '图片',
icon: 'image',
component: LbpPicture,
visible: true,
name: 'lbp-picture'
}
]
},
{
title: '表单',
icon: 'wpforms',
visible: true,
children: [
{
title: '按钮',
icon: 'hand-pointer-o',
component: LbpButton,
visible: true,
name: 'lbp-button'
},
{
title: '图片',
icon: 'image',
component: LbpPicture,
visible: true,
name: 'lbp-picture'
}
]
}
]
export default {
extends: CoreEditor,
computed: {
// !#zh 显示在侧边栏或顶部的 可用组件列表
visiblePluginList () {
return PluginList.filter(p => p.visible)
},
groups () {
return PluginList.filter(p => p.visible)
}
},
methods: {
mixinPlugins2Editor () {
PluginList.forEach(plugin => {
// 全局注册组件,便于以后扩展自定义脚本,注释原来的局部注册:this.$options.components[plugin.name] = plugin.component
Vue.component(plugin.name, plugin.component)
})
}
},
created () {
this.mixinPlugins2Editor()
}
}
</script>
<style lang="scss">
$cellSize: 35.6px;
$designerWidth: 320px;
$designerHeight: 568px;
$designerWidthHalf: $designerWidth / 2;
.canvas-wrapper {
position: relative;
top: 5%;
width: $designerWidth;
height: $designerHeight;
border: 1px #ebeaea solid;
margin: 0 auto;
background: #fff;
}
.lb-tabs {
box-shadow: none;
padding: 4px 8px 4px 0;
border: 1px solid #EBEEF5;
height: 100%;
}
.full-height {
height: 100% !important;
}
</style>