feat:【mall】diy editor 的 magic-cube 注释

This commit is contained in:
YunaiV
2025-10-29 09:52:01 +08:00
parent d6faed9d0e
commit fa383159ea
3 changed files with 23 additions and 36 deletions

View File

@@ -2,39 +2,26 @@ import type { ComponentStyle, DiyComponent } from '../../../util';
/** 广告魔方属性 */ /** 广告魔方属性 */
export interface MagicCubeProperty { export interface MagicCubeProperty {
// 上圆角 borderRadiusTop: number; // 上圆角
borderRadiusTop: number; borderRadiusBottom: number; // 下圆角
// 下圆角 space: number; // 间隔
borderRadiusBottom: number; list: MagicCubeItemProperty[]; // 导航菜单列表
// 间隔 style: ComponentStyle; // 组件样式
space: number;
// 导航菜单列表
list: MagicCubeItemProperty[];
// 组件样式
style: ComponentStyle;
} }
/** 广告魔方项目属性 */ /** 广告魔方项目属性 */
export interface MagicCubeItemProperty { export interface MagicCubeItemProperty {
// 图标链接 imgUrl: string; // 图标链接
imgUrl: string; url: string; // 链接
// 链接 width: number; //
url: string; height: number; // 高
// top: number; //
width: number; left: number; // 左
// right: number; //
height: number; bottom: number; // 下
// 上
top: number;
// 左
left: number;
// 右
right: number;
// 下
bottom: number;
} }
// 定义组件 /** 定义组件 */
export const component = { export const component = {
id: 'MagicCube', id: 'MagicCube',
name: '广告魔方', name: '广告魔方',

View File

@@ -9,9 +9,11 @@ import { ElImage } from 'element-plus';
/** 广告魔方 */ /** 广告魔方 */
defineOptions({ name: 'MagicCube' }); defineOptions({ name: 'MagicCube' });
const props = defineProps<{ property: MagicCubeProperty }>(); const props = defineProps<{ property: MagicCubeProperty }>();
// 一个方块的大小
const CUBE_SIZE = 93.75; const CUBE_SIZE = 93.75; // 一个方块的大小
/** /**
* 计算方块的行数 * 计算方块的行数
* 行数用于计算魔方的总体高度,存在以下情况: * 行数用于计算魔方的总体高度,存在以下情况:
@@ -80,5 +82,3 @@ const rowCount = computed(() => {
</div> </div>
</div> </div>
</template> </template>
<style scoped lang="scss"></style>

View File

@@ -18,11 +18,14 @@ import ComponentContainerProperty from '../../component-container-property.vue';
defineOptions({ name: 'MagicCubeProperty' }); defineOptions({ name: 'MagicCubeProperty' });
const props = defineProps<{ modelValue: MagicCubeProperty }>(); const props = defineProps<{ modelValue: MagicCubeProperty }>();
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit); const formData = useVModel(props, 'modelValue', emit);
// 选中的热区 const selectedHotAreaIndex = ref(-1); // 选中的热区
const selectedHotAreaIndex = ref(-1);
/** 处理热区被选中事件 */
const handleHotAreaSelected = (_: any, index: number) => { const handleHotAreaSelected = (_: any, index: number) => {
selectedHotAreaIndex.value = index; selectedHotAreaIndex.value = index;
}; };
@@ -30,7 +33,6 @@ const handleHotAreaSelected = (_: any, index: number) => {
<template> <template>
<ComponentContainerProperty v-model="formData.style"> <ComponentContainerProperty v-model="formData.style">
<!-- 表单 -->
<ElForm label-width="80px" :model="formData" class="mt-2"> <ElForm label-width="80px" :model="formData" class="mt-2">
<ElText tag="p"> 魔方设置 </ElText> <ElText tag="p"> 魔方设置 </ElText>
<ElText type="info" size="small"> 每格尺寸187 * 187 </ElText> <ElText type="info" size="small"> 每格尺寸187 * 187 </ElText>
@@ -89,5 +91,3 @@ const handleHotAreaSelected = (_: any, index: number) => {
</ElForm> </ElForm>
</ComponentContainerProperty> </ComponentContainerProperty>
</template> </template>
<style scoped lang="scss"></style>