houzhongjian
2024-08-08 820397e43a0b64d35c6d31d2a55475061438593b
提交 | 用户 | 时间
820397 1 <template>
H 2   <ComponentContainerProperty v-model="formData.style">
3     <!-- 表单 -->
4     <el-form label-width="80px" :model="formData" class="m-t-8px">
5       <el-text tag="p"> 魔方设置 </el-text>
6       <el-text type="info" size="small"> 每格尺寸187 * 187 </el-text>
7       <MagicCubeEditor
8         class="m-y-16px"
9         v-model="formData.list"
10         :rows="4"
11         :cols="4"
12         @hot-area-selected="handleHotAreaSelected"
13       />
14       <template v-for="(hotArea, index) in formData.list" :key="index">
15         <template v-if="selectedHotAreaIndex === index">
16           <el-form-item label="上传图片" :prop="`list[${index}].imgUrl`">
17             <UploadImg v-model="hotArea.imgUrl" height="80px" width="80px" />
18           </el-form-item>
19           <el-form-item label="链接" :prop="`list[${index}].url`">
20             <AppLinkInput v-model="hotArea.url" />
21           </el-form-item>
22         </template>
23       </template>
24       <el-form-item label="上圆角" prop="borderRadiusTop">
25         <el-slider
26           v-model="formData.borderRadiusTop"
27           :max="100"
28           :min="0"
29           show-input
30           input-size="small"
31           :show-input-controls="false"
32         />
33       </el-form-item>
34       <el-form-item label="下圆角" prop="borderRadiusBottom">
35         <el-slider
36           v-model="formData.borderRadiusBottom"
37           :max="100"
38           :min="0"
39           show-input
40           input-size="small"
41           :show-input-controls="false"
42         />
43       </el-form-item>
44       <el-form-item label="间隔" prop="space">
45         <el-slider
46           v-model="formData.space"
47           :max="100"
48           :min="0"
49           show-input
50           input-size="small"
51           :show-input-controls="false"
52         />
53       </el-form-item>
54     </el-form>
55   </ComponentContainerProperty>
56 </template>
57
58 <script setup lang="ts">
59 import { usePropertyForm } from '@/components/DiyEditor/util'
60 import { MagicCubeProperty } from '@/components/DiyEditor/components/mobile/MagicCube/config'
61
62 /** 广告魔方属性面板 */
63 defineOptions({ name: 'MagicCubeProperty' })
64
65 const props = defineProps<{ modelValue: MagicCubeProperty }>()
66 const emit = defineEmits(['update:modelValue'])
67 const { formData } = usePropertyForm(props.modelValue, emit)
68
69 // 选中的热区
70 const selectedHotAreaIndex = ref(-1)
71 const handleHotAreaSelected = (_: any, index: number) => {
72   selectedHotAreaIndex.value = index
73 }
74 </script>
75
76 <style scoped lang="scss"></style>