banner-item.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div class="bannar" v-if="basicSet.pc_temp2_set && basicSet.pc_temp2_set.banner && basicSet.pc_temp2_set.banner.length > 0">
  3. <!--首页显示-->
  4. <div class="swiper m-auto" v-if=" basicSet.pc_temp2_set.banner.length > 0">
  5. <el-carousel trigger="click" arrow="never" :autoplay="true">
  6. <el-carousel-item v-for="(item, index) in basicSet.pc_temp2_set.banner" :key="index">
  7. <img :class="[item.url? 'hoverClass':'']" :src="item.img_src" @click="toLink(item)">
  8. </el-carousel-item>
  9. </el-carousel>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. import {mapState} from 'vuex'
  15. export default {
  16. data() {
  17. return {};
  18. },
  19. computed: {
  20. ...mapState(['basicSet', 'basic_info'])
  21. },
  22. mounted() {},
  23. methods: {
  24. toLink(item) {
  25. if(item.url) {
  26. window.open(item.url, "_blank");
  27. }else if(item.pc_link) {
  28. window.open(item.pc_link, "_blank");
  29. }else if(item.pc_adv_url) {
  30. window.open(item.pc_adv_url, "_blank");
  31. }
  32. }
  33. }
  34. };
  35. </script>
  36. <style lang="scss" scoped>
  37. .bannar {
  38. width: 690px;
  39. height: 350px;
  40. background-color: #0090ff;
  41. border-radius: 5px;
  42. overflow: hidden;
  43. .swiper {
  44. width: 690px;
  45. cursor: pointer;
  46. :deep(.el-carousel__container) {
  47. height: 350px;
  48. }
  49. :deep(.el-carousel__button) {
  50. width: 16px;
  51. height: 6px;
  52. background-color: #fff;
  53. border-radius: 3px;
  54. opacity: 1;
  55. }
  56. :deep(.el-carousel__indicator.is-active) button {
  57. background-color: var(--color);
  58. }
  59. img {
  60. width:100%;
  61. height:100%;
  62. /*border-radius: 10px;*/
  63. }
  64. }
  65. .swiper.fill-swiper {
  66. padding-top: 0;
  67. width: 100%;
  68. :deep(.el-carousel__container) {
  69. height: 350px;
  70. }
  71. }
  72. .hoverClass {
  73. cursor: pointer;
  74. }
  75. }
  76. </style>