DialogContent.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div class="dialog-chat-answer-content" :style="custom_style">
  3. <div v-if="is_loading">
  4. <a-spin></a-spin>
  5. </div>
  6. <div v-if="!is_loading" v-html="content" />
  7. <slot></slot>
  8. </div>
  9. </template>
  10. <script setup>
  11. import { computed } from 'vue';
  12. // 接收markdown数据,进行一些转换
  13. const props = defineProps({
  14. /**
  15. * 内容类型
  16. */
  17. type: String,
  18. /**
  19. * 文本内容
  20. */
  21. content: String,
  22. /**
  23. * 状态值
  24. */
  25. is_loading: Boolean,
  26. /**
  27. * 内容区域最大宽度
  28. */
  29. max_width: Number
  30. });
  31. const custom_style = computed(() => {
  32. if (props.max_width) {
  33. return `max-width: ${props.max_width}px;`;
  34. } else {
  35. ('');
  36. }
  37. });
  38. </script>
  39. <style lang="css" scoped>
  40. .dialog-chat-answer-content {
  41. background-color: var(--color-bg-1);
  42. color: var(--color-text-1);
  43. border-radius: 10px;
  44. padding: 18px;
  45. /* box-shadow: 0 0 5px #dedede; */
  46. box-shadow: 0 0 5px var(--color-text-4);
  47. }
  48. .dialog-chat-answer-content code {
  49. overflow-x: auto;
  50. }
  51. </style>