Commit 605a9e1a authored by 郝聪敏's avatar 郝聪敏

fix: dots保存在组件内部

parent 92c63c3c
This diff is collapsed.
......@@ -23,7 +23,7 @@ export default class Activity extends Vue {
@Watch('pageName', { immediate: true })
onPageNameChange(newVal) {
if (newVal) {
if (EASY_ENV_IS_BROWSER && newVal) {
document.title = newVal;
// 如果是 iOS 设备,则使用如下 hack 的写法实现页面标题的更新
if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
......
......@@ -119,6 +119,9 @@ export default class DynamicForm extends Mixins(ContextMenu) {
case 'number' :
result = 'Number';
break;
case 'Upload':
result = 'Upload';
break;
}
return result;
}
......
......@@ -16,6 +16,8 @@ export default class FreedomContainer extends Mixins(ContextMenu) {
@Prop({ type: Boolean, default: false }) showHeader;
@Prop(String) backgroundImage;
dots: object = {};
mousedown(childIndex, event) {
this.setDragable(false);
const childItem = cloneDeep(this.childItem);
......@@ -63,7 +65,7 @@ export default class FreedomContainer extends Mixins(ContextMenu) {
@Watch('curChildIndex')
onIndexChange(newVal) {
this.childItem.child.forEach(item => delete item.dots);
this.dots = {};
if (newVal || newVal === 0) {
this.setPointStyle();
}
......@@ -74,14 +76,12 @@ export default class FreedomContainer extends Mixins(ContextMenu) {
this.$nextTick(() => {
const points = ['lt', 'rt', 'lb', 'rb', 'l', 'r', 't', 'b'];
const [height, width] = this.getHW(this.curChildIndex);
const dots = points.reduce((pre, cur) => {
this.dots[this.curChildIndex] = points.reduce((pre, cur) => {
pre[cur] = convertPointStyle(cur, {height, width});
return pre;
}, {});
const childEle = this.childItem.child[this.curChildIndex];
// this.updatePageInfo({ containerIndex: this.containerIndex, childIndex: this.curChildIndex, data: { ...childEle, commonStyle: { ...childEle.commonStyle, height: +height, width: +width } } });
this.updateCommonStyle({ containerIndex: this.containerIndex, childIndex: this.curChildIndex, data: { ...childEle.commonStyle, height: +height, width: +width }});
this.$set(this.childItem.child[this.curChildIndex], 'dots', dots);
});
}
......
......@@ -4,7 +4,7 @@
<div v-for="(item, index) in childItem.child" :style="transformStyle(item.commonStyle, 'container')" :class="['freedom-body-item', { 'Fb-item_selected': curChildIndex === index }]" :key="index" @click.stop="handleElementClick(containerIndex, index)" @mousedown.stop="mousedown(index, $event)" @contextmenu.prevent.stop="show($event, containerIndex, index)">
<component ref="childComponent" :style="transformStyle(item.commonStyle, 'component')" :is="item.name" v-bind="item.props"></component>
<div class="freedom-body-dot"
v-for="(style, key) in item.dots"
v-for="(style, key) in dots[index]"
:key="key"
:style="style"
@mousedown.stop.prevent="handleMouseDownOnPoint(key, $event)"/>
......
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