RightItemMessage.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div style="width: calc(100vw - 74px)" class="flex justify-end items-start mb-16">
  3. <!-- 文字消息 -->
  4. <template v-if="itemData?.messageType == 0 && itemData.messageContent.trim()">
  5. <div
  6. class="text-left inline-block min-h-40 max-w-full break-words overflow-auto rounded-[4px] relative bg-white box-border text-base p-5 text-wrap"
  7. >
  8. {{ messageContentParse(itemData.messageContent) }}
  9. </div>
  10. <div class="inline-block w-0 h-0 mt-10 border-[8px] border-transparent border-l-white"></div>
  11. </template>
  12. <!-- 图片消息 -->
  13. <template v-if="item.messageType == 1">
  14. <div class="ml-10 max-w-251 border right left">
  15. <img
  16. @click="handleimagePreview"
  17. class="w-full h-full object-contain"
  18. src="../../assets/img/comment/H5_default.png"
  19. alt=""
  20. />
  21. <!-- <ChatImage :item-data="_default" @on-delete="$emit('onDelete')" /> -->
  22. </div>
  23. </template>
  24. <div class="shrink-0 w-40 h-40 rounded-[4px]">
  25. <img
  26. v-if="itemData?.haeadImage"
  27. class="w-full h-full object-cover"
  28. :src="itemData.haeadImage"
  29. alt=""
  30. />
  31. <img v-else class="w-full h-full object-cover" src="~/assets/img/default_avatar.png" alt="" />
  32. </div>
  33. </div>
  34. </template>
  35. <script setup>
  36. defineProps({
  37. itemData: {
  38. type: Object,
  39. default: () => ({})
  40. }
  41. })
  42. defineEmits(['onDelete'])
  43. // 图片预览
  44. const handleimagePreview = () => {
  45. showImagePreview({
  46. images: [
  47. 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
  48. 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg'
  49. ],
  50. startPosition: 1
  51. })
  52. }
  53. </script>
  54. <style lang="scss" scoped></style>