DiamondEdit.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <el-dialog v-model="visible" title="金刚区编辑" width="600px" :close-on-click-modal="false">
  3. <div class="diamond-edit">
  4. <div v-for="(item, index) in items" :key="index"
  5. class="flex items-center gap-4 mb-4 p-3 border rounded bg-gray-50 relative group">
  6. <ImageUpload v-model="item.image" :limit="1" :isShowTip="false" />
  7. <div class="flex-1">
  8. <el-input v-model="item.title" placeholder="请输入标题 (不超过5个字)" maxlength="5" show-word-limit
  9. class="mb-2" />
  10. <el-input v-model="item.link" placeholder="请输入跳转链接" size="small">
  11. <template #prepend>链接</template>
  12. </el-input>
  13. </div>
  14. </div>
  15. </div>
  16. <template #footer>
  17. <span class="dialog-footer">
  18. <el-button @click="visible = false">取消</el-button>
  19. <el-button type="primary" @click="handleConfirm">确定</el-button>
  20. </span>
  21. </template>
  22. </el-dialog>
  23. </template>
  24. <script setup>
  25. import { computed, ref, watch } from 'vue';
  26. import { Plus, Delete } from '@element-plus/icons-vue';
  27. import ImageUpload from '@/components/ImageUpload/index.vue';
  28. const props = defineProps({
  29. modelValue: {
  30. type: Boolean,
  31. default: false
  32. }
  33. });
  34. const emit = defineEmits(['update:modelValue']);
  35. const visible = computed({
  36. get: () => props.modelValue,
  37. set: (val) => emit('update:modelValue', val)
  38. });
  39. const items = ref([
  40. { title: '', image: '', link: '' },
  41. { title: '', image: '', link: '' },
  42. { title: '', image: '', link: '' },
  43. { title: '', image: '', link: '' },
  44. { title: '', image: '', link: '' },
  45. { title: '', image: '', link: '' },
  46. { title: '', image: '', link: '' },
  47. { title: '', image: '', link: '' },
  48. { title: '', image: '', link: '' },
  49. { title: '', image: '', link: '' }
  50. ]);
  51. const handleConfirm = () => {
  52. // Save logic here
  53. visible.value = false;
  54. };
  55. </script>
  56. <style scoped>
  57. .diamond-edit {
  58. max-height: 60vh;
  59. overflow-y: auto;
  60. }
  61. </style>