diff --git a/src/components/model-custom/components/index.vue b/src/components/model-custom/components/index.vue index a92ee653..2f33e054 100644 --- a/src/components/model-custom/components/index.vue +++ b/src/components/model-custom/components/index.vue @@ -587,7 +587,7 @@ const dragEndHandle = (new_val: any, index: number) => { const { location: old_location, com_data, id: old_id } = cloneDeep(diy_data.value[index]) const { data_follow = {}, com_width, com_height, is_data_update } = com_data; // 处理后的x、y坐标 - const { new_x, new_y } = new_location_handle(old_location, data_follow, new_val, 0, 0); + const { new_x, new_y } = new_location_handle(old_location, data_follow, new_val, 0, 0, true); if (data_follow?.id == '') { // 如果有跟随的模版,则需要更新跟随的模版的位置 const index = diy_data.value.findIndex(item => old_id == item.com_data?.data_follow?.id); @@ -611,7 +611,7 @@ const resizingHandle = (new_location: any, key: string, index: number, type: str const com_data = diy_data.value[index].com_data; const { data_follow } = com_data; // 处理后的x、y坐标,宽度和高度 - const { new_x, new_y, new_w, new_h} = new_location_handle(old_location, data_follow, new_location, old_com_data.com_width, old_com_data.com_height); + const { new_x, new_y, new_w, new_h} = new_location_handle(old_location, data_follow, new_location, old_com_data.com_width, old_com_data.com_height, false); if (data_follow.id == '') { // 如果有跟随的模版,则需要更新跟随的模版的位置 const index = diy_data.value.findIndex(item => old_id == item.com_data.data_follow.id); diff --git a/src/utils/index.ts b/src/utils/index.ts index 5d2d1a46..57c9a5c8 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -891,7 +891,7 @@ type DataFollow = { id: string; type: string; } -export const new_location_handle = (old_location: Location, data_follow: DataFollow, location: Location, com_width: number, com_height: number) => { +export const new_location_handle = (old_location: Location, data_follow: DataFollow, location: Location, com_width: number, com_height: number, is_show_message: boolean) => { let new_x = old_location.x; let new_y = old_location.y; let new_w = com_width; @@ -900,13 +900,13 @@ export const new_location_handle = (old_location: Location, data_follow: DataFol // 如果是跟随的模版,根据选中的内容 x或者y不变 if (data_follow.id != '') { if (data_follow.type == 'left') { - if (old_location.x !== x) { + if (old_location.x !== x && is_show_message) { is_show_message_warning('当前组件已经左跟随其他组件,x轴不允许修改'); } new_y = y; new_h = location?.h || com_height; } else if (data_follow.type == 'top') { - if (old_location.y !== y) { + if (old_location.y !== y && is_show_message) { is_show_message_warning('当前组件已经上跟随其他组件,y轴不允许修改'); } new_x = x;