feat:【mall】diy editor 的 popover 优化
This commit is contained in:
@@ -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: '弹窗广告',
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
Reference in New Issue
Block a user