feat:【antd】【mall】diy-editor 代码风格统一 & 逐个测试 40%
This commit is contained in:
@@ -110,6 +110,7 @@ const handleDeleteComponent = () => {
|
||||
v-if="showToolbar && component.name && active"
|
||||
>
|
||||
<!-- TODO @xingyu:按钮少的时候,会存在遮住的情况; -->
|
||||
<!-- TODO @xingyu:貌似中间的选中框框,没全部框柱。上面多了点,下面少了点。 -->
|
||||
<VerticalButtonGroup size="small">
|
||||
<Button
|
||||
:disabled="!canMoveUp"
|
||||
|
||||
@@ -15,10 +15,9 @@ import { getSeckillActivityListByIds } from '#/api/mall/promotion/seckill/seckil
|
||||
|
||||
/** 秒杀卡片 */
|
||||
defineOptions({ name: 'PromotionSeckill' });
|
||||
// 定义属性
|
||||
const props = defineProps<{ property: PromotionSeckillProperty }>();
|
||||
// 商品列表
|
||||
const spuList = ref<MallSpuApi.Spu[]>([]);
|
||||
|
||||
const spuList = ref<MallSpuApi.Spu[]>([]); // 商品列表
|
||||
const spuIdList = ref<number[]>([]);
|
||||
const seckillActivityList = ref<MallSeckillActivityApi.SeckillActivity[]>([]);
|
||||
|
||||
@@ -28,7 +27,7 @@ watch(
|
||||
try {
|
||||
// 新添加的秒杀组件,是没有活动ID的
|
||||
const activityIds = props.property.activityIds;
|
||||
// 检查活动ID的有效性
|
||||
// 检查活动 ID 的有效性
|
||||
if (Array.isArray(activityIds) && activityIds.length > 0) {
|
||||
// 获取秒杀活动详情列表
|
||||
seckillActivityList.value =
|
||||
@@ -66,32 +65,25 @@ watch(
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* 计算商品的间距
|
||||
* @param index 商品索引
|
||||
*/
|
||||
const calculateSpace = (index: number) => {
|
||||
// 商品的列数
|
||||
const columns = props.property.layoutType === 'twoCol' ? 2 : 1;
|
||||
// 第一列没有左边距
|
||||
const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`;
|
||||
// 第一行没有上边距
|
||||
const marginTop = index < columns ? '0' : `${props.property.space}px`;
|
||||
|
||||
/** 计算商品的间距 */
|
||||
function calculateSpace(index: number) {
|
||||
const columns = props.property.layoutType === 'twoCol' ? 2 : 1; // 商品的列数
|
||||
const marginLeft = index % columns === 0 ? '0' : `${props.property.space}px`; // 第一列没有左边距
|
||||
const marginTop = index < columns ? '0' : `${props.property.space}px`; // 第一行没有上边距
|
||||
return { marginLeft, marginTop };
|
||||
};
|
||||
}
|
||||
|
||||
// 容器
|
||||
const containerRef = ref();
|
||||
// 计算商品的宽度
|
||||
const calculateWidth = () => {
|
||||
const containerRef = ref(); // 容器
|
||||
|
||||
/** 计算商品的宽度 */
|
||||
function calculateWidth() {
|
||||
let width = '100%';
|
||||
// 双列时每列的宽度为:(总宽度 - 间距)/ 2
|
||||
if (props.property.layoutType === 'twoCol') {
|
||||
// 双列时每列的宽度为:(总宽度 - 间距)/ 2
|
||||
width = `${(containerRef.value.offsetWidth - props.property.space) / 2}px`;
|
||||
}
|
||||
return { width };
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
|
||||
@@ -19,8 +19,7 @@ import {
|
||||
|
||||
import UploadImg from '#/components/upload/image-upload.vue';
|
||||
import { ColorInput } from '#/views/mall/promotion/components';
|
||||
// TODO: 添加组件
|
||||
// import { SeckillShowcase } from '#/views/mall/promotion/seckill/components';
|
||||
import { SeckillShowcase } from '#/views/mall/promotion/seckill/components';
|
||||
|
||||
import ComponentContainerProperty from '../../component-container-property.vue';
|
||||
|
||||
|
||||
@@ -11,7 +11,10 @@ defineOptions({ name: 'TitleBar' });
|
||||
defineProps<{ property: TitleBarProperty }>();
|
||||
</script>
|
||||
<template>
|
||||
<div class="title-bar" :style="{ height: `${property.height}px` }">
|
||||
<div
|
||||
class="relative box-border min-h-[20px] w-full"
|
||||
:style="{ height: `${property.height}px` }"
|
||||
>
|
||||
<Image
|
||||
v-if="property.bgImgUrl"
|
||||
:src="property.bgImgUrl"
|
||||
@@ -51,7 +54,7 @@ defineProps<{ property: TitleBarProperty }>();
|
||||
</div>
|
||||
<!-- 更多 -->
|
||||
<div
|
||||
class="more"
|
||||
class="absolute bottom-0 right-2 top-0 m-auto flex items-center justify-center text-[10px] text-[#969799]"
|
||||
v-show="property.more.show"
|
||||
:style="{
|
||||
color: property.descriptionColor,
|
||||
@@ -67,25 +70,3 @@ defineProps<{ property: TitleBarProperty }>();
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.title-bar {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-height: 20px;
|
||||
|
||||
/* 更多 */
|
||||
.more {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 8px;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: auto;
|
||||
font-size: 10px;
|
||||
color: #969799;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user