gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<script setup lang="ts">
import type { HotZoneProperty } from './config';
 
import { ref } from 'vue';
 
import { useVModel } from '@vueuse/core';
import { Button, Form, FormItem } from 'ant-design-vue';
 
import UploadImg from '#/components/upload/image-upload.vue';
 
import ComponentContainerProperty from '../../component-container-property.vue';
import HotZoneEditDialog from './components/hot-zone-edit-dialog/index.vue';
 
/** 热区属性面板 */
defineOptions({ name: 'HotZoneProperty' });
 
const props = defineProps<{ modelValue: HotZoneProperty }>();
 
const emit = defineEmits(['update:modelValue']);
 
const formData = useVModel(props, 'modelValue', emit);
 
const editDialogRef = ref(); // 热区编辑对话框
 
/** 打开热区编辑对话框 */
function handleOpenEditDialog() {
  editDialogRef.value.open();
}
</script>
 
<template>
  <ComponentContainerProperty v-model="formData.style">
    <!-- 表单 -->
    <Form
      :label-col="{ style: { width: '80px' } }"
      :model="formData"
      class="mt-2"
    >
      <FormItem label="上传图片" name="imgUrl">
        <UploadImg
          v-model="formData.imgUrl"
          height="50px"
          width="auto"
          class="min-w-[80px]"
          :show-description="false"
        >
          <!-- TODO @芋艿:这里不提示;是不是组件得封装下;-->
          <template #tip> 推荐宽度 750 </template>
        </UploadImg>
      </FormItem>
    </Form>
 
    <Button type="primary" ghost class="w-full" @click="handleOpenEditDialog">
      设置热区
    </Button>
  </ComponentContainerProperty>
 
  <!-- 热区编辑对话框 -->
  <HotZoneEditDialog
    ref="editDialogRef"
    v-model="formData.list"
    :img-url="formData.imgUrl"
  />
</template>