feat:【mall】diy editor 恢复中间,宽度还有点问题

This commit is contained in:
YunaiV
2025-10-28 07:45:27 +08:00
parent fd58c4c4e4
commit b5c8197f20
3 changed files with 25 additions and 30 deletions

View File

@@ -49,9 +49,8 @@ const emits = defineEmits<{
type DiyComponentWithStyle = DiyComponent<any> & { type DiyComponentWithStyle = DiyComponent<any> & {
property: { style?: ComponentStyle }; property: { style?: ComponentStyle };
}; };
/**
* 组件样式 /** 组件样式 */
*/
const style = computed(() => { const style = computed(() => {
const componentStyle = props.component.property.style; const componentStyle = props.component.property.style;
if (!componentStyle) { if (!componentStyle) {
@@ -78,24 +77,17 @@ const style = computed(() => {
}; };
}); });
/** /** 移动组件 */
* 移动组件
* @param direction 移动方向
*/
const handleMoveComponent = (direction: number) => { const handleMoveComponent = (direction: number) => {
emits('move', direction); emits('move', direction);
}; };
/** /** 复制组件 */
* 复制组件
*/
const handleCopyComponent = () => { const handleCopyComponent = () => {
emits('copy'); emits('copy');
}; };
/** /** 删除组件 */
* 删除组件
*/
const handleDeleteComponent = () => { const handleDeleteComponent = () => {
emits('delete'); emits('delete');
}; };

View File

@@ -14,16 +14,15 @@ import { componentConfigs } from './mobile/index';
/** 组件库:目前左侧的【基础组件】、【图文组件】部分 */ /** 组件库:目前左侧的【基础组件】、【图文组件】部分 */
defineOptions({ name: 'ComponentLibrary' }); defineOptions({ name: 'ComponentLibrary' });
// 组件列表 /** 组件列表 */
const props = defineProps<{ const props = defineProps<{
list: DiyComponentLibrary[]; list: DiyComponentLibrary[];
}>(); }>();
// 组件分组
const groups = reactive<any[]>([]);
// 展开的折叠面板
const extendGroups = reactive<string[]>([]);
// 监听 list 属性,按照 DiyComponentLibrary 的 name 分组 const groups = reactive<any[]>([]); // 组件分组
const extendGroups = reactive<string[]>([]); // 展开的折叠面板
/** 监听 list 属性,按照 DiyComponentLibrary 的 name 分组 */
watch( watch(
() => props.list, () => props.list,
() => { () => {
@@ -53,7 +52,7 @@ watch(
}, },
); );
// 克隆组件 /** 克隆组件 */
const handleCloneComponent = (component: DiyComponent<any>) => { const handleCloneComponent = (component: DiyComponent<any>) => {
const instance = cloneDeep(component); const instance = cloneDeep(component);
instance.uid = Date.now(); instance.uid = Date.now();

View File

@@ -595,12 +595,15 @@ $phone-width: 375px;
} }
/* 手机页面编辑区域 */ /* 手机页面编辑区域 */
:deep(.editor-design-center) {
width: 100%;
/* 主体内容 */
.phone-container { .phone-container {
position: relative; position: relative;
width: $phone-width; width: $phone-width;
height: 100%; height: 100%;
margin: 0 auto; margin: 0 auto;
overflow-x: hidden;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
@@ -609,6 +612,7 @@ $phone-width: 375px;
height: 100%; height: 100%;
} }
} }
}
/* 固定布局的组件 操作按钮区 */ /* 固定布局的组件 操作按钮区 */
.fixed-component-action-group { .fixed-component-action-group {