提交 | 用户 | 时间
820397 1 <template>
H 2   <ComponentContainerProperty v-model="formData.style">
3     <el-form label-width="80px" :model="formData">
4       <el-card header="样式设置" class="property-group" shadow="never">
5         <el-form-item label="样式" prop="type">
6           <el-radio-group v-model="formData.type">
7             <el-tooltip class="item" content="默认" placement="bottom">
9259c2 8               <el-radio-button value="default">
820397 9                 <Icon icon="system-uicons:carousel" />
H 10               </el-radio-button>
11             </el-tooltip>
12             <el-tooltip class="item" content="卡片" placement="bottom">
9259c2 13               <el-radio-button value="card">
820397 14                 <Icon icon="ic:round-view-carousel" />
H 15               </el-radio-button>
16             </el-tooltip>
17           </el-radio-group>
18         </el-form-item>
19         <el-form-item label="指示器" prop="indicator">
20           <el-radio-group v-model="formData.indicator">
9259c2 21             <el-radio value="dot">小圆点</el-radio>
H 22             <el-radio value="number">数字</el-radio>
820397 23           </el-radio-group>
H 24         </el-form-item>
25         <el-form-item label="是否轮播" prop="autoplay">
26           <el-switch v-model="formData.autoplay" />
27         </el-form-item>
28         <el-form-item label="播放间隔" prop="interval" v-if="formData.autoplay">
29           <el-slider
30             v-model="formData.interval"
31             :max="10"
32             :min="0.5"
33             :step="0.5"
34             show-input
35             input-size="small"
36             :show-input-controls="false"
37           />
38           <el-text type="info">单位:秒</el-text>
39         </el-form-item>
40       </el-card>
41       <el-card header="内容设置" class="property-group" shadow="never">
42         <Draggable v-model="formData.items" :empty-item="{ type: 'img' }">
43           <template #default="{ element }">
44             <el-form-item label="类型" prop="type" class="m-b-8px!" label-width="40px">
45               <el-radio-group v-model="element.type">
9259c2 46                 <el-radio value="img">图片</el-radio>
H 47                 <el-radio value="video">视频</el-radio>
820397 48               </el-radio-group>
H 49             </el-form-item>
50             <el-form-item
51               label="图片"
52               class="m-b-8px!"
53               label-width="40px"
54               v-if="element.type === 'img'"
55             >
56               <UploadImg
57                 v-model="element.imgUrl"
58                 draggable="false"
59                 height="80px"
60                 width="100%"
61                 class="min-w-80px"
62               />
63             </el-form-item>
64             <template v-else>
65               <el-form-item label="封面" class="m-b-8px!" label-width="40px">
66                 <UploadImg
67                   v-model="element.imgUrl"
68                   draggable="false"
69                   height="80px"
70                   width="100%"
71                   class="min-w-80px"
72                 />
73               </el-form-item>
74               <el-form-item label="视频" class="m-b-8px!" label-width="40px">
75                 <UploadFile
76                   v-model="element.videoUrl"
77                   :file-type="['mp4']"
78                   :limit="1"
79                   :file-size="100"
80                   class="min-w-80px"
81                 />
82               </el-form-item>
83             </template>
84             <el-form-item label="链接" class="m-b-8px!" label-width="40px">
85               <AppLinkInput v-model="element.url" />
86             </el-form-item>
87           </template>
88         </Draggable>
89       </el-card>
90     </el-form>
91   </ComponentContainerProperty>
92 </template>
93
94 <script setup lang="ts">
95 import { CarouselProperty } from './config'
96 import { usePropertyForm } from '@/components/DiyEditor/util'
97
98 // 轮播图属性面板
99 defineOptions({ name: 'CarouselProperty' })
100
101 const props = defineProps<{ modelValue: CarouselProperty }>()
102 const emit = defineEmits(['update:modelValue'])
103 const { formData } = usePropertyForm(props.modelValue, emit)
104 </script>
105
106 <style scoped lang="scss"></style>