feat:【mall】diy editor 的 popover 优化

This commit is contained in:
YunaiV
2025-11-01 10:16:40 +08:00
parent 48292b1a98
commit 98e3078784
3 changed files with 18 additions and 20 deletions

View File

@@ -2,19 +2,17 @@ import type { DiyComponent } from '../../../util';
/** 弹窗广告属性 */ /** 弹窗广告属性 */
export interface PopoverProperty { export interface PopoverProperty {
list: PopoverItemProperty[]; list: PopoverItemProperty[]; // 弹窗列表
} }
/** 弹窗广告项目属性 */
export interface PopoverItemProperty { export interface PopoverItemProperty {
// 图片地址 imgUrl: string; // 图片地址
imgUrl: string; url: string; // 跳转连接
// 跳转连接 showType: 'always' | 'once'; // 显示类型:仅显示一次、每次启动都会显示
url: string;
// 显示类型:仅显示一次、每次启动都会显示
showType: 'always' | 'once';
} }
// 定义组件 /** 定义组件 */
export const component = { export const component = {
id: 'Popover', id: 'Popover',
name: '弹窗广告', name: '弹窗广告',

View File

@@ -9,18 +9,20 @@ import { ElImage } from 'element-plus';
/** 弹窗广告 */ /** 弹窗广告 */
defineOptions({ name: 'Popover' }); defineOptions({ name: 'Popover' });
//
defineProps<{ property: PopoverProperty }>();
// const props = defineProps<{ property: PopoverProperty }>();
const activeIndex = ref(0);
const handleActive = (index: number) => { const activeIndex = ref(0); // index
/** 处理选中 */
function handleActive(index: number) {
activeIndex.value = index; activeIndex.value = index;
}; }
</script> </script>
<template> <template>
<div <div
v-for="(item, index) in property.list" v-for="(item, index) in props.property.list"
:key="index" :key="index"
class="absolute bottom-1/2 right-1/2 h-[454px] w-[292px] rounded border border-gray-300 bg-white p-0.5" class="absolute bottom-1/2 right-1/2 h-[454px] w-[292px] rounded border border-gray-300 bg-white p-0.5"
:style="{ :style="{
@@ -40,5 +42,3 @@ const handleActive = (index: number) => {
<div class="absolute right-1 top-1 text-xs">{{ index + 1 }}</div> <div class="absolute right-1 top-1 text-xs">{{ index + 1 }}</div>
</div> </div>
</template> </template>
<style scoped lang="scss"></style>

View File

@@ -13,11 +13,13 @@ import {
import UploadImg from '#/components/upload/image-upload.vue'; import UploadImg from '#/components/upload/image-upload.vue';
import { AppLinkInput, Draggable } from '#/views/mall/promotion/components'; import { AppLinkInput, Draggable } from '#/views/mall/promotion/components';
// 广 /** 弹窗广告属性面板 */
defineOptions({ name: 'PopoverProperty' }); defineOptions({ name: 'PopoverProperty' });
const props = defineProps<{ modelValue: PopoverProperty }>(); const props = defineProps<{ modelValue: PopoverProperty }>();
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit); const formData = useVModel(props, 'modelValue', emit);
</script> </script>
@@ -53,5 +55,3 @@ const formData = useVModel(props, 'modelValue', emit);
</Draggable> </Draggable>
</ElForm> </ElForm>
</template> </template>
<style scoped lang="scss"></style>