hjyd的手机端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="news_container">
  3. <HeadLine title="新闻/NEWS" line1="获取行业最新咨询" />
  4. <div class="card_wrap">
  5. <div class="card" v-for="(item, index) in newsList" :key="item.id">
  6. <div :class="activeTab == item.id ? 'header active' : 'header'">
  7. <div class="wrap" @click="changeActiveWrap(item.id)">
  8. <img class="icon" :src="item.icon" />
  9. <p class="font">{{ item.title }}</p>
  10. </div>
  11. </div>
  12. <img class="img" :src="getList()[index].pic" />
  13. <div class="bottom">
  14. <p class="title">{{ getList()[index].productTitle }}</p>
  15. <p class="desc">{{ getList()[index].desc }}</p>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script setup>
  22. import HeadLine from 'cpns/HeadLine'
  23. import { newsList } from '@/mock'
  24. import { ref } from 'vue'
  25. const activeTab = ref(1)
  26. const changeActiveWrap = id => {
  27. activeTab.value = id
  28. }
  29. const getList = () => {
  30. const arr = newsList.filter(item => item.id == activeTab.value)
  31. return arr[0].list
  32. }
  33. </script>
  34. <style lang="scss" scoped>
  35. .news_container {
  36. background: #fff;
  37. .card_wrap {
  38. display: grid;
  39. grid-template-columns: repeat(3, 1fr);
  40. padding: 0 7px;
  41. box-sizing: border-box;
  42. border-radius: 3px;
  43. overflow: hidden;
  44. .card {
  45. flex: 1;
  46. background: #ededed;
  47. .header {
  48. display: flex;
  49. align-items: center;
  50. justify-content: center;
  51. .wrap {
  52. display: flex;
  53. align-items: center;
  54. padding: 7px 0;
  55. box-sizing: border-box;
  56. .icon {
  57. min-width: 13px;
  58. min-height: 13px;
  59. }
  60. .font {
  61. font-size: 16px;
  62. transform: scale(0.5);
  63. font-family: Alibaba PuHuiTi;
  64. font-weight: 400;
  65. white-space: nowrap;
  66. width: 200%;
  67. }
  68. }
  69. }
  70. .active {
  71. background: #f94622;
  72. color: #ffffff;
  73. }
  74. .img {
  75. width: 100%;
  76. height: auto;
  77. }
  78. .bottom {
  79. padding: 8px;
  80. box-sizing: border-box;
  81. .title {
  82. font-size: 14px;
  83. font-family: Source Han Sans CN;
  84. font-weight: 400;
  85. color: #262626;
  86. transform: scale(0.5);
  87. transform-origin: 0 center;
  88. max-width: 100px;
  89. white-space: nowrap;
  90. }
  91. .desc {
  92. font-size: 12px;
  93. font-family: Source Han Sans CN;
  94. font-weight: 300;
  95. color: #afafaf;
  96. transform: scale(0.5);
  97. transform-origin: 0 center;
  98. white-space: nowrap;
  99. max-width: 100px;
  100. }
  101. }
  102. }
  103. }
  104. }
  105. </style>