刷新部件时简版部件位置不正确问题

This commit is contained in:
猴赛雷 2024-10-17 17:11:15 +08:00
parent 8776a8bb45
commit 416f11a91b
3 changed files with 28 additions and 22 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ddei-editor", "name": "ddei-editor",
"version": "1.2.41-210", "version": "1.2.41-211-2",
"private": false, "private": false,
"type": "module", "type": "module",
"author": "hoslay <3697355039@qq.com>", "author": "hoslay <3697355039@qq.com>",

View File

@ -58,6 +58,7 @@ export default {
}, },
data() { data() {
return { return {
groups:null,
forceRefresh: true, forceRefresh: true,
forceRefreshGroup: true, forceRefreshGroup: true,
}; };
@ -76,7 +77,8 @@ export default {
// //
const { width, height } = entry.contentRect; const { width, height } = entry.contentRect;
if (width != 0 && height != 0) { if (width != 0 && height != 0) {
this.width = width
this.height = height
this.resetPosition(width,height) this.resetPosition(width,height)
} }
@ -182,29 +184,27 @@ export default {
this.editor.ddInstance.initRender() this.editor.ddInstance.initRender()
} }
//groups //groups
let groups = [] if(!this.groups){
for(let i = 0;i < this.options?.groups?.length;i++){ let groups = []
let group = clone(this.options.groups[i]) for(let i = 0;i < this.options?.groups?.length;i++){
let controls = [] let group = clone(this.options.groups[i])
group.controls?.forEach(controlid => { let controls = []
let control = this.editor.controls.get(controlid) group.controls?.forEach(controlid => {
if(control){ let control = this.editor.controls.get(controlid)
controls.push(control) if(control){
controls.push(control)
}
});
if (controls.length > 0){
group.controls = controls;
} }
}); groups.push(group)
if (controls.length > 0){
group.controls = controls;
}
groups.push(group)
}
this.groups = groups
} }
this.groups = groups
this.forceRefresh = false
this.$nextTick(() => {
this.forceRefresh = true;
});
}, },
// //
@ -214,7 +214,9 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.forceRefresh = true; this.forceRefresh = true;
if (this.refreshData) { if (this.refreshData) {
this.refreshData(); this.$nextTick(() => {
this.resetPosition(this.width,this.height)
});
} }
}); });
} }

View File

@ -73,7 +73,8 @@ export default {
// //
const { width, height } = entry.contentRect; const { width, height } = entry.contentRect;
if (width != 0 && height != 0) { if (width != 0 && height != 0) {
this.width = width
this.height = height
this.resetPosition(width,height) this.resetPosition(width,height)
} }
@ -428,6 +429,9 @@ export default {
this.forceRefresh = true; this.forceRefresh = true;
if (this.refreshData) { if (this.refreshData) {
this.refreshData(); this.refreshData();
this.$nextTick(() => {
this.resetPosition(this.width, this.height)
})
} }
}); });
} }