2.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <!--皮肤1和皮肤2的 第二个样式是一样的-->
  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. <!--皮肤1和皮肤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. <!-- 样式6 -->
  63. <div class="BannerListBox BannerListBoxStyle6" v-if="componentStyle == 6">
  64. <div class="listNewsTitle">
  65. <span>头条新闻</span>
  66. </div>
  67. <div v-for="item in component_News_1" :key="item.id">
  68. <NuxtLink
  69. :href="getLinkPathDetail(item)"
  70. :title="item.title"
  71. :target="item.islink == 1 ? '_blank' : '_self'"
  72. >
  73. {{ item.title }}
  74. </NuxtLink>
  75. </div>
  76. </div>
  77. </template>
  78. <script setup>
  79. //引入vue
  80. import {ref} from 'vue';
  81. //获得新闻数据
  82. const props = defineProps({
  83. componentStyle:Number,//样式编号
  84. templateData:Array,//新闻数据
  85. });
  86. //获取新闻数据
  87. const component_News = ref(props.templateData);
  88. const component_News_1 = component_News.value.slice(0,9);
  89. </script>
  90. <style lang="less" scoped>
  91. //基本样式 start ---------------------------------------->
  92. .BannerListBox {
  93. div {
  94. cursor: pointer;
  95. font-size:18px;
  96. color: #333;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. white-space: nowrap;
  100. height:26px;
  101. line-height: 26px;
  102. margin-bottom: 16px;
  103. a {
  104. font-size:18px;
  105. color: #333;
  106. }
  107. &:last-child {
  108. margin-bottom: 0;
  109. }
  110. }
  111. }
  112. //基本样式 end ---------------------------------------->
  113. //样式1 start ---------------------------------------->
  114. .BannerListBoxStyle1 {
  115. div {
  116. cursor: pointer;
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. white-space: nowrap;
  120. height:26px;
  121. line-height: 26px;
  122. margin-bottom: 16px;
  123. a {
  124. font-size:18px;
  125. color: #333;
  126. }
  127. &:nth-child(1),&:nth-child(6){
  128. a {
  129. color: #A91B33;
  130. font-weight: bold;
  131. }
  132. }
  133. &:last-child {
  134. margin-bottom: 0;
  135. }
  136. }
  137. }
  138. //样式1 end ---------------------------------------->
  139. //样式2 start ---------------------------------------->
  140. .BannerListBoxStyle2 {
  141. div {
  142. a {
  143. color: #333;
  144. }
  145. &:nth-child(1),&:nth-child(6){
  146. a {
  147. color: #333333;
  148. font-weight: bold;
  149. }
  150. }
  151. &:last-child {
  152. margin-bottom: 0;
  153. }
  154. }
  155. }
  156. //样式2 end ---------------------------------------->
  157. //样式3
  158. .BannerListBoxStyle3 {
  159. div {
  160. a {
  161. color: #333;
  162. }
  163. &:nth-child(1){
  164. a {
  165. color: #A91B33;
  166. font-weight: bold;
  167. }
  168. }
  169. &:last-child {
  170. margin-bottom: 0;
  171. }
  172. }
  173. }
  174. //样式4
  175. .BannerListBoxStyle4 {
  176. div {
  177. a {
  178. color: #333;
  179. }
  180. &:nth-child(1){
  181. a {
  182. color: #333333;
  183. font-weight: bold;
  184. }
  185. }
  186. &:last-child {
  187. margin-bottom: 0;
  188. }
  189. }
  190. }
  191. //样式5
  192. .BannerListBoxStyle5 {
  193. div{
  194. a {
  195. color: #333;
  196. }
  197. }
  198. }
  199. //样式6
  200. .BannerListBoxStyle6 {
  201. div{
  202. margin-bottom: 14px;
  203. }
  204. .listNewsTitle {
  205. font-size: 22px;
  206. font-weight: bold;
  207. height: 40px;
  208. line-height: 40px;
  209. border-bottom: 1px solid #e4e4e4;
  210. color: #A91B33;
  211. margin-bottom: 20px;
  212. box-sizing: border-box;
  213. padding-bottom: 45px;
  214. span {
  215. color: #A91B33;
  216. height: 30px;
  217. line-height: 30px;
  218. border-left: 3px solid #A91B33;
  219. padding-left: 12px;
  220. font-weight: bold;
  221. }
  222. }
  223. }
  224. </style>