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 {
list: PopoverItemProperty[];
list: PopoverItemProperty[]; // 弹窗列表
}
/** 弹窗广告项目属性 */
export interface PopoverItemProperty {
// 图片地址
imgUrl: string;
// 跳转连接
url: string;
// 显示类型:仅显示一次、每次启动都会显示
showType: 'always' | 'once';
imgUrl: string; // 图片地址
url: string; // 跳转连接
showType: 'always' | 'once'; // 显示类型:仅显示一次、每次启动都会显示
}
// 定义组件
/** 定义组件 */
export const component = {
id: 'Popover',
name: '弹窗广告',

View File

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

View File

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