From 12968a3d66b9725f0e83a85e5d515ded04756f1f Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 1 Nov 2025 08:47:47 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20editor?= =?UTF-8?q?=20=E7=9A=84=20menu-swiper=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/menu-swiper/config.ts | 54 ++++++++----------- .../components/mobile/menu-swiper/index.vue | 30 +++++------ .../mobile/menu-swiper/property.vue | 6 +-- 3 files changed, 35 insertions(+), 55 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts index 27138ebee..fa83498c8 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/config.ts @@ -4,40 +4,28 @@ import { cloneDeep } from '@vben/utils'; /** 菜单导航属性 */ export interface MenuSwiperProperty { - // 布局: 图标+文字 | 图标 - layout: 'icon' | 'iconText'; - // 行数 - row: number; - // 列数 - column: number; - // 导航菜单列表 - list: MenuSwiperItemProperty[]; - // 组件样式 - style: ComponentStyle; -} -/** 菜单导航项目属性 */ -export interface MenuSwiperItemProperty { - // 图标链接 - iconUrl: string; - // 标题 - title: string; - // 标题颜色 - titleColor: string; - // 链接 - url: string; - // 角标 - badge: { - // 角标背景颜色 - bgColor: string; - // 是否显示 - show: boolean; - // 角标文字 - text: string; - // 角标文字颜色 - textColor: string; - }; + layout: 'icon' | 'iconText'; // 布局:图标+文字 | 图标 + row: number; // 行数 + column: number; // 列数 + list: MenuSwiperItemProperty[]; // 导航菜单列表 + style: ComponentStyle; // 组件样式 } +/** 菜单导航项目属性 */ +export interface MenuSwiperItemProperty { + iconUrl: string; // 图标链接 + title: string; // 标题 + titleColor: string; // 标题颜色 + url: string; // 链接 + badge: { + bgColor: string; // 角标背景颜色 + show: boolean; // 是否显示 + text: string; // 角标文字 + textColor: string; // 角标文字颜色 + }; // 角标 +} + +/** 空菜单导航项目属性 */ export const EMPTY_MENU_SWIPER_ITEM_PROPERTY = { title: '标题', titleColor: '#333', @@ -48,7 +36,7 @@ export const EMPTY_MENU_SWIPER_ITEM_PROPERTY = { }, } as MenuSwiperItemProperty; -// 定义组件 +/** 定义组件 */ export const component = { id: 'MenuSwiper', name: '菜单导航', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue index 0d69c7c86..fb4304522 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/menu-swiper/index.vue @@ -7,22 +7,19 @@ import { ElCarousel, ElCarouselItem, ElImage } from 'element-plus'; /** 菜单导航 */ defineOptions({ name: 'MenuSwiper' }); -const props = defineProps<{ property: MenuSwiperProperty }>(); -// 标题的高度 -const TITLE_HEIGHT = 20; -// 图标的高度 -const ICON_SIZE = 32; -// 垂直间距:一行上下的间距 -const SPACE_Y = 16; -// 分页 -const pages = ref([]); -// 轮播图高度 -const carouselHeight = ref(0); -// 行高 -const rowHeight = ref(0); -// 列宽 -const columnWidth = ref(''); +const props = defineProps<{ property: MenuSwiperProperty }>(); + +const TITLE_HEIGHT = 20; // 标题的高度 +const ICON_SIZE = 32; // 图标的高度 +const SPACE_Y = 16; // 垂直间距:一行上下的间距 + +const pages = ref([]); // 分页 +const carouselHeight = ref(0); // 轮播图高度 + +const rowHeight = ref(0); // 行高 +const columnWidth = ref(''); // 列宽 + watch( () => props.property, () => { @@ -75,9 +72,7 @@ watch( class="relative flex flex-col items-center justify-center" :style="{ width: columnWidth, height: `${rowHeight}px` }" > -
-
- (); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit); - -