From 0f3f220d4b3a66dc65a0522e9eff10024cf2c2a5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 28 Oct 2025 15:13:50 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20editor?= =?UTF-8?q?=20=E7=9A=84=20carousel=20=E7=BB=9F=E4=B8=80=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/{Carousel => carousel}/config.ts | 39 +++++++------------ .../mobile/{Carousel => carousel}/index.vue | 6 +-- .../{Carousel => carousel}/property.vue | 2 + 3 files changed, 20 insertions(+), 27 deletions(-) rename apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/{Carousel => carousel}/config.ts (61%) rename apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/{Carousel => carousel}/index.vue (95%) rename apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/{Carousel => carousel}/property.vue (99%) diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/config.ts b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/config.ts similarity index 61% rename from apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/config.ts rename to apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/config.ts index f63a0bcb6..4d040e325 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/config.ts +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/config.ts @@ -2,32 +2,23 @@ import type { ComponentStyle, DiyComponent } from '../../../util'; /** 轮播图属性 */ export interface CarouselProperty { - // 类型:默认 | 卡片 - type: 'card' | 'default'; - // 指示器样式:点 | 数字 - indicator: 'dot' | 'number'; - // 是否自动播放 - autoplay: boolean; - // 播放间隔 - interval: number; - // 轮播内容 - items: CarouselItemProperty[]; - // 组件样式 - style: ComponentStyle; -} -// 轮播内容属性 -export interface CarouselItemProperty { - // 类型:图片 | 视频 - type: 'img' | 'video'; - // 图片链接 - imgUrl: string; - // 视频链接 - videoUrl: string; - // 跳转链接 - url: string; + type: 'card' | 'default'; // 类型:默认 | 卡片 + indicator: 'dot' | 'number'; // 指示器样式:点 | 数字 + autoplay: boolean; // 是否自动播放 + interval: number; // 播放间隔 + items: CarouselItemProperty[]; // 轮播内容 + style: ComponentStyle; // 组件样式 } -// 定义组件 +/** 轮播内容属性 */ +export interface CarouselItemProperty { + type: 'img' | 'video'; // 类型:图片 | 视频 + imgUrl: string; // 图片链接 + videoUrl: string; // 视频链接 + url: string; // 跳转链接 +} + +/** 定义组件 */ export const component = { id: 'Carousel', name: '轮播图', diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/index.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/index.vue similarity index 95% rename from apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/index.vue rename to apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/index.vue index df256770c..0f204bd18 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/index.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/index.vue @@ -12,7 +12,9 @@ defineOptions({ name: 'Carousel' }); defineProps<{ property: CarouselProperty }>(); -const currentIndex = ref(0); +const currentIndex = ref(0); // 当前索引 + +/** 处理索引变化 */ const handleIndexChange = (index: number) => { currentIndex.value = index + 1; }; @@ -46,5 +48,3 @@ const handleIndexChange = (index: number) => { - - diff --git a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/property.vue b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/property.vue similarity index 99% rename from apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/property.vue rename to apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/property.vue index 1e23b0e32..1cd60005f 100644 --- a/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/Carousel/property.vue +++ b/apps/web-ele/src/views/mall/promotion/components/diy-editor/components/mobile/carousel/property.vue @@ -26,7 +26,9 @@ import ComponentContainerProperty from '../../component-container-property.vue'; defineOptions({ name: 'CarouselProperty' }); const props = defineProps<{ modelValue: CarouselProperty }>(); + const emit = defineEmits(['update:modelValue']); + const formData = useVModel(props, 'modelValue', emit);