InsertTitleSection.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <div
  3. class="relative box-border flex min-h-60 items-center justify-between space-x-10 rounded-lg border border-dashed border-primary bg-white px-10 py-10"
  4. ref="target"
  5. >
  6. <van-cell-group class="border" inset>
  7. <van-field
  8. v-model="title"
  9. rows="1"
  10. autosize
  11. label-width="5"
  12. type="textarea"
  13. placeholder="请输入段落标题..."
  14. maxlength="50"
  15. show-word-limit
  16. ></van-field>
  17. </van-cell-group>
  18. <span class="text-3xl text-black-3">{{ title }}</span>
  19. <div
  20. v-show="!isOutside"
  21. class="absolute right-0 top-0 flex h-26 items-center justify-center space-x-15 bg-[rgba(0,0,0,0.7)] px-12 transition-all"
  22. >
  23. <span
  24. @click="$emit('onEdit')"
  25. class="iconfont icon-edit-square cursor-pointer text-white"
  26. style="font-size: 18px"
  27. ></span>
  28. <span
  29. @click="$emit('onDelete')"
  30. class="iconfont icon-delete cursor-pointer text-white"
  31. style="font-size: 18px"
  32. ></span>
  33. </div>
  34. </div>
  35. </template>
  36. <script setup>
  37. import { useMouseInElement } from '@vueuse/core'
  38. const target = ref(null)
  39. const { isOutside } = useMouseInElement(target)
  40. const props = defineProps({
  41. title: String
  42. })
  43. defineEmits(['onEdit', 'onDelete'])
  44. </script>
  45. <style lang="scss" scoped></style>