listTwo.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view class="list-item-box">
  3. <img class="list-img" :src="data.cover||defaultImg">
  4. <view class="list-time-box" :class="{'time-red-box': type == 1}">
  5. <view class="time-data">{{ formatDate[1] }}</view>
  6. <view class="time-year">{{formatDate[0]}}</view>
  7. </view>
  8. <view class="list-right-box">
  9. <h1 class="list-name">{{ data.title }}</h1>
  10. <view class="list-line"></view>
  11. <view class="list-content" v-html="getStringByHtml3(data.content)">
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script setup>
  17. import {
  18. ref,
  19. reactive,
  20. computed
  21. } from "vue";
  22. import {
  23. getStringByHtml3,
  24. formatDateToYearMonthDay
  25. } from "@/utils/common.js"
  26. import default2 from '@/static/images/common/news-bj2.png'
  27. import default1 from '@/static/images/common/news-bj1.jpg'
  28. const props = defineProps({
  29. data: {
  30. type: Object
  31. },
  32. type: {
  33. type: Number
  34. }
  35. })
  36. const formatDate = computed(() => {
  37. return formatDateToYearMonthDay(props.data.createTime)
  38. })
  39. const defaultImg = computed(() => {
  40. return props.type == 1 ? default1 : default2
  41. })
  42. </script>
  43. <style>
  44. </style>