article.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <script setup lang="ts">
  2. import dayjs from 'dayjs'
  3. import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html.vue'
  4. import view from '@designer-hub/assets/src/libs/assets/view'
  5. const props = defineProps({
  6. title: {
  7. type: String,
  8. default: '',
  9. },
  10. author: {
  11. type: Object,
  12. default: () => ({ name: '匿名' }),
  13. },
  14. createdAt: {
  15. type: Date,
  16. default: () => new Date(),
  17. },
  18. viewNum: {
  19. type: Number,
  20. default: 0,
  21. },
  22. content: {
  23. type: String,
  24. default: '<div>1111</div>',
  25. },
  26. })
  27. </script>
  28. <template>
  29. <div class="px-3.5 bg-white flex-grow">
  30. <div class="text-black text-xl font-normal font-['PingFang_SC'] leading-loose">
  31. {{ title }}
  32. </div>
  33. <div class="flex items-center my-5">
  34. <div class="w-7 h-7 overflow-hidden roudnded-full">
  35. <slot name="avatar"></slot>
  36. </div>
  37. <div class="flex-1 ml-1">
  38. <div class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal">
  39. {{ author.name }}
  40. </div>
  41. <div class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal">
  42. 编辑于
  43. {{ dayjs(createdAt).format('YYYY/MM/DD') }}
  44. </div>
  45. </div>
  46. <div class="flex items-center gap-1">
  47. <slot name="viewLeft"></slot>
  48. <!-- <wd-icon name="view" size="18" color="rgba(0,0,0,.45)"></wd-icon> -->
  49. <wd-img :src="view" width="18" height="18"></wd-img>
  50. <div class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal">
  51. {{ viewNum || 0 }}
  52. </div>
  53. </div>
  54. </div>
  55. <!-- <u-parse :content="content"></u-parse> -->
  56. <!-- <div class="content" v-html="content"></div> -->
  57. <mpHtml :content="content"></mpHtml>
  58. </div>
  59. </template>
  60. <style lang="scss"></style>