message-abstract-image.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <div :class="['message-abstract-image-container']">
  3. <img
  4. :class="['message-abstract-image']"
  5. :src="imageUrl"
  6. >
  7. </div>
  8. </template>
  9. <script setup lang="ts">
  10. import { withDefaults, computed } from '../../../../../adapter-vue';
  11. import { IImageMessageContent } from '../../../../../interface';
  12. interface IProps {
  13. messageContent: Record<string, unknown> | IImageMessageContent | undefined;
  14. }
  15. const props = withDefaults(defineProps<IProps>(), {
  16. messageContent: () => ({}) as IImageMessageContent,
  17. });
  18. const imageUrl = computed<string>(() => (props.messageContent as IImageMessageContent).url || '');
  19. </script>
  20. <style scoped lang="scss">
  21. @import "../../../../../assets/styles/common";
  22. .message-abstract-image-container {
  23. max-width: 100px;
  24. max-height: 100px;
  25. width: 100px;
  26. height: 100px;
  27. overflow: hidden;
  28. background-color: #fff;
  29. .message-abstract-image {
  30. max-width: 100px;
  31. max-height: 100px;
  32. width: 100px;
  33. height: 100px;
  34. object-fit: contain;
  35. }
  36. }
  37. </style>