feat:【mall】diy editor 的 menu-list 优化

This commit is contained in:
YunaiV
2025-11-01 08:42:55 +08:00
parent 356e8071ed
commit 27b35ac0cf
3 changed files with 19 additions and 27 deletions

View File

@@ -4,28 +4,21 @@ import { cloneDeep } from '@vben/utils';
/** 列表导航属性 */ /** 列表导航属性 */
export interface MenuListProperty { export interface MenuListProperty {
// 导航菜单列表 list: MenuListItemProperty[]; // 导航菜单列表
list: MenuListItemProperty[]; style: ComponentStyle; // 组件样式
// 组件样式
style: ComponentStyle;
} }
/** 列表导航项目属性 */ /** 列表导航项目属性 */
export interface MenuListItemProperty { export interface MenuListItemProperty {
// 图标链接 iconUrl: string; // 图标链接
iconUrl: string; title: string; // 标题
// 标题 titleColor: string; // 标题颜色
title: string; subtitle: string; // 副标题
// 标题颜色 subtitleColor: string; // 标题颜色
titleColor: string; url: string; // 链接
// 副标题
subtitle: string;
// 副标题颜色
subtitleColor: string;
// 链接
url: string;
} }
/** 空的列表导航项目属性 */
export const EMPTY_MENU_LIST_ITEM_PROPERTY = { export const EMPTY_MENU_LIST_ITEM_PROPERTY = {
title: '标题', title: '标题',
titleColor: '#333', titleColor: '#333',
@@ -33,7 +26,7 @@ export const EMPTY_MENU_LIST_ITEM_PROPERTY = {
subtitleColor: '#bbb', subtitleColor: '#bbb',
}; };
// 定义组件 /** 定义组件 */
export const component = { export const component = {
id: 'MenuList', id: 'MenuList',
name: '列表导航', name: '列表导航',

View File

@@ -7,6 +7,7 @@ import { ElImage } from 'element-plus';
/** 列表导航 */ /** 列表导航 */
defineOptions({ name: 'MenuList' }); defineOptions({ name: 'MenuList' });
defineProps<{ property: MenuListProperty }>(); defineProps<{ property: MenuListProperty }>();
</script> </script>
@@ -19,14 +20,14 @@ defineProps<{ property: MenuListProperty }>();
> >
<div class="flex flex-1 flex-row items-center gap-2"> <div class="flex flex-1 flex-row items-center gap-2">
<ElImage v-if="item.iconUrl" class="h-4 w-4" :src="item.iconUrl" /> <ElImage v-if="item.iconUrl" class="h-4 w-4" :src="item.iconUrl" />
<span class="text-base" :style="{ color: item.titleColor }">{{ <span class="text-base" :style="{ color: item.titleColor }">
item.title {{ item.title }}
}}</span> </span>
</div> </div>
<div class="item-center flex flex-row justify-center gap-1"> <div class="item-center flex flex-row justify-center gap-1">
<span class="text-xs" :style="{ color: item.subtitleColor }">{{ <span class="text-xs" :style="{ color: item.subtitleColor }">
item.subtitle {{ item.subtitle }}
}}</span> </span>
<IconifyIcon icon="ep:arrow-right" color="#000" :size="16" /> <IconifyIcon icon="ep:arrow-right" color="#000" :size="16" />
</div> </div>
</div> </div>

View File

@@ -18,7 +18,9 @@ import { EMPTY_MENU_LIST_ITEM_PROPERTY } from './config';
defineOptions({ name: 'MenuListProperty' }); defineOptions({ name: 'MenuListProperty' });
const props = defineProps<{ modelValue: MenuListProperty }>(); const props = defineProps<{ modelValue: MenuListProperty }>();
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit); const formData = useVModel(props, 'modelValue', emit);
</script> </script>
@@ -26,8 +28,6 @@ const formData = useVModel(props, 'modelValue', emit);
<ComponentContainerProperty v-model="formData.style"> <ComponentContainerProperty v-model="formData.style">
<ElText tag="p"> 菜单设置 </ElText> <ElText tag="p"> 菜单设置 </ElText>
<ElText type="info" size="small"> 拖动左侧的小圆点可以调整顺序 </ElText> <ElText type="info" size="small"> 拖动左侧的小圆点可以调整顺序 </ElText>
<!-- 表单 -->
<ElForm label-width="60px" :model="formData" class="mt-2"> <ElForm label-width="60px" :model="formData" class="mt-2">
<Draggable <Draggable
v-model="formData.list" v-model="formData.list"
@@ -64,5 +64,3 @@ const formData = useVModel(props, 'modelValue', emit);
</ElForm> </ElForm>
</ComponentContainerProperty> </ComponentContainerProperty>
</template> </template>
<style scoped lang="scss"></style>