property.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  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. <el-input v-model="hotArea.url" placeholder="请输入链接" />
  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. <script setup lang="ts">
  58. import { usePropertyForm } from '@/components/DiyEditor/util'
  59. import { MagicCubeProperty } from '@/components/DiyEditor/components/mobile/MagicCube/config'
  60. /** 广告魔方属性面板 */
  61. defineOptions({ name: 'MagicCubeProperty' })
  62. const props = defineProps<{ modelValue: MagicCubeProperty }>()
  63. const emit = defineEmits(['update:modelValue'])
  64. const { formData } = usePropertyForm(props.modelValue, emit)
  65. // 选中的热区
  66. const selectedHotAreaIndex = ref(-1)
  67. const handleHotAreaSelected = (_: any, index: number) => {
  68. selectedHotAreaIndex.value = index
  69. }
  70. </script>
  71. <style scoped lang="scss"></style>