2.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <div class="listNewsBox">
  3. <div v-for="item in listData">
  4. <NuxtLink
  5. :href="getLinkPathDetail(item)"
  6. :title="item.title"
  7. :target="item.islink == 1 ? '_blank' : '_self'"
  8. >
  9. {{getTitleLength(item.title,45)}}
  10. <span>{{getTime(item.updated_at, 'month', 1)}}</span>
  11. </NuxtLink>
  12. </div>
  13. </div>
  14. </template>
  15. <script setup>
  16. //引入vue
  17. import {ref} from 'vue';
  18. //获得新闻数据
  19. const props = defineProps({
  20. listData:Array//新闻数据
  21. });
  22. </script>
  23. <style lang="less" scoped>
  24. //基本样式 start ---------------------------------------->
  25. .listNewsBox {
  26. div{
  27. height: 24px;
  28. line-height: 24px;
  29. color:#333333;
  30. font-size:18px;
  31. margin-bottom: 20px;
  32. a {
  33. color:#333333;
  34. }
  35. &:nth-child(5n) {
  36. height: 54px;
  37. //padding-bottom:30px;
  38. border-bottom: 1px solid #D9D9D9;
  39. }
  40. &:nth-child(5n+1) {
  41. //font-weight: bold;
  42. margin-top: 30px;
  43. }
  44. &:first-child {
  45. margin-top: 0;
  46. }
  47. span {
  48. float: right;
  49. }
  50. &:last-child {
  51. margin-bottom: 0;
  52. }
  53. }
  54. }
  55. //基本样式 end ---------------------------------------->
  56. </style>