1.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <!-- 样式1 -->
  3. <div class="BannerListBox BannerListBoxStyle1" v-if="componentStyle == 1">
  4. <div v-for="item in component_News" :key="item.id">
  5. <NuxtLink
  6. :href="getLinkPathDetail(item)"
  7. :title="item.title"
  8. :target="item.islink == 1 ? '_blank' : '_self'"
  9. >
  10. {{ item.title }}
  11. </NuxtLink>
  12. </div>
  13. </div>
  14. <!-- 样式2 -->
  15. <div class="BannerListBox BannerListBoxStyle2" v-if="componentStyle == 2">
  16. <div v-for="item in component_News" :key="item.id">
  17. <NuxtLink
  18. :href="getLinkPathDetail(item)"
  19. :title="item.title"
  20. :target="item.islink == 1 ? '_blank' : '_self'"
  21. >
  22. {{ item.title }}
  23. </NuxtLink>
  24. </div>
  25. </div>
  26. <!-- 样式3 -->
  27. <div class="BannerListBox BannerListBoxStyle3" v-if="componentStyle == 3">
  28. <div v-for="item in component_News" :key="item.id">
  29. <NuxtLink
  30. :href="getLinkPathDetail(item)"
  31. :title="item.title"
  32. :target="item.islink == 1 ? '_blank' : '_self'"
  33. >
  34. {{ item.title }}
  35. </NuxtLink>
  36. </div>
  37. </div>
  38. <!-- 样式4 -->
  39. <div class="BannerListBox BannerListBoxStyle4" v-if="componentStyle == 4">
  40. <div v-for="item in component_News" :key="item.id">
  41. <NuxtLink
  42. :href="getLinkPathDetail(item)"
  43. :title="item.title"
  44. :target="item.islink == 1 ? '_blank' : '_self'"
  45. >
  46. {{ item.title }}
  47. </NuxtLink>
  48. </div>
  49. </div>
  50. <!-- 样式5 -->
  51. <div class="BannerListBox BannerListBoxStyle5" v-if="componentStyle == 5">
  52. <div v-for="item in component_News" :key="item.id">
  53. <NuxtLink
  54. :href="getLinkPathDetail(item)"
  55. :title="item.title"
  56. :target="item.islink == 1 ? '_blank' : '_self'"
  57. >
  58. {{ item.title }}
  59. </NuxtLink>
  60. </div>
  61. </div>
  62. </template>
  63. <script setup>
  64. //引入vue
  65. import { ref } from 'vue';
  66. //获得新闻数据
  67. const props = defineProps({
  68. componentStyle: Number,//样式编号
  69. templateData: Array,//新闻数据
  70. });
  71. //获取新闻数据
  72. const component_News = ref(props.templateData);
  73. </script>
  74. <style lang="less" scoped>
  75. //基本样式 start ---------------------------------------->
  76. .BannerListBox {
  77. div {
  78. cursor: pointer;
  79. font-size: 18px;
  80. color: #333;
  81. overflow: hidden;
  82. text-overflow: ellipsis;
  83. white-space: nowrap;
  84. height: 26px;
  85. line-height: 26px;
  86. margin-bottom: 16px;
  87. a {
  88. font-size: 18px;
  89. color: #333;
  90. }
  91. &:last-child {
  92. margin-bottom: 0;
  93. }
  94. }
  95. }
  96. //基本样式 end ---------------------------------------->
  97. //样式1 start ---------------------------------------->
  98. .BannerListBoxStyle1 {
  99. div {
  100. cursor: pointer;
  101. overflow: hidden;
  102. text-overflow: ellipsis;
  103. white-space: nowrap;
  104. height: 26px;
  105. line-height: 26px;
  106. margin-bottom: 16px;
  107. a {
  108. font-size: 18px;
  109. color: #333;
  110. }
  111. &:nth-child(1),
  112. &:nth-child(6) {
  113. a {
  114. color: #004564;
  115. font-weight: bold;
  116. }
  117. }
  118. &:last-child {
  119. margin-bottom: 0;
  120. }
  121. }
  122. }
  123. //样式1 end ---------------------------------------->
  124. //样式2 start ---------------------------------------->
  125. .BannerListBoxStyle2 {
  126. div {
  127. a {
  128. color: #333;
  129. }
  130. &:nth-child(1),
  131. &:nth-child(6) {
  132. a {
  133. color: #333333;
  134. font-weight: bold;
  135. }
  136. }
  137. &:last-child {
  138. margin-bottom: 0;
  139. }
  140. }
  141. }
  142. //样式2 end ---------------------------------------->
  143. //样式3
  144. .BannerListBoxStyle3 {
  145. div {
  146. a {
  147. color: #333;
  148. }
  149. &:nth-child(1){
  150. a {
  151. color: #004564;
  152. font-weight: bold;
  153. }
  154. }
  155. &:last-child {
  156. margin-bottom: 0;
  157. }
  158. }
  159. }
  160. //样式4
  161. .BannerListBoxStyle4 {
  162. div {
  163. a {
  164. color: #333;
  165. }
  166. &:nth-child(1){
  167. a {
  168. color: #333333;
  169. font-weight: bold;
  170. }
  171. }
  172. &:last-child {
  173. margin-bottom: 0;
  174. }
  175. }
  176. }
  177. //样式5
  178. .BannerListBoxStyle5 {
  179. div{
  180. a {
  181. color: #333;
  182. }
  183. }
  184. }
  185. // </style>