提交 b8f95eef authored 作者: wangjiahao's avatar wangjiahao

feat: 预览和编辑相同的gap效果

上级 314a100f
<template> <template>
<div @click="handleClick"> <div
:style="getOutStyleDefault(config.style)"
:class="{'gap_class':canvasStyleData.panel.gap==='yes'}"
class="component"
@click="handleClick"
>
<component <component
:is="config.component" :is="config.component"
v-if="config.type==='custom'" v-if="config.type==='custom'"
:id="'component' + config.id" :id="'component' + config.id"
class="component" :style="getComponentStyleDefault(config.style)"
:style="getStyle(config.style)"
:out-style="config.style" :out-style="config.style"
:element="config" :element="config"
:class="{'gap_class':canvasStyleData.panel.gap==='yes'}"
/> />
<component <component
:is="config.component" :is="config.component"
v-else v-else
class="component"
:out-style="config.style" :out-style="config.style"
:style="getStyle(config.style)" :style="getComponentStyleDefault(config.style)"
:prop-value="config.propValue" :prop-value="config.propValue"
:element="config" :element="config"
:class="{'gap_class':canvasStyleData.panel.gap==='yes'}"
/> />
</div> </div>
</template> </template>
...@@ -54,6 +55,26 @@ export default { ...@@ -54,6 +55,26 @@ export default {
methods: { methods: {
getStyle, getStyle,
getOutStyleDefault(style) {
const result = {};
['width', 'left'].forEach(attr => {
result[attr] = style[attr] + 'px'
});
['height', 'top'].forEach(attr => {
result[attr] = style[attr] + 'px'
})
result['rotate'] = style['rotate']
result['opacity'] = style['opacity']
return result
// return style
},
getComponentStyleDefault(style) {
return getStyle(style, ['top', 'left', 'width', 'height', 'rotate'])
// return style
},
handleClick() { handleClick() {
const events = this.config.events const events = this.config.events
Object.keys(events).forEach(event => { Object.keys(events).forEach(event => {
...@@ -68,4 +89,8 @@ export default { ...@@ -68,4 +89,8 @@ export default {
.component { .component {
position: absolute; position: absolute;
} }
.gap_class{
padding:3px;
}
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论