index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="oa-swiper-slide">
  3. <slot name="header" v-if="list.length > 0"></slot>
  4. <swiper
  5. class="oa-swiper"
  6. :indicator-dots="indicatorDots"
  7. :autoplay="autoplay"
  8. :interval="interval"
  9. :duration="duration"
  10. vertical="true"
  11. >
  12. <swiper-item
  13. class="oa-swiper-item"
  14. @tap="navTo"
  15. v-for="(item, index) in list"
  16. :key="index"
  17. >
  18. <view class="text in1line">
  19. <text class="newsTitle">{{item.title}}</text>
  20. </view>
  21. </swiper-item>
  22. </swiper>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: 'oa-swiper-slide',
  28. data() {
  29. return {
  30. indicatorDots: false,
  31. autoplay: true,
  32. interval: 2000,
  33. duration: 500
  34. };
  35. },
  36. props: {
  37. list: {
  38. type: Array,
  39. default() {
  40. return [];
  41. }
  42. },
  43. autoplay:false,
  44. },
  45. mounted(){
  46. console.log(this.list)
  47. },
  48. methods: {
  49. navTo() {
  50. this.$emit('navTo');
  51. }
  52. }
  53. };
  54. </script>
  55. <style scoped lang="scss">
  56. .oa-swiper-slide {
  57. display: flex;
  58. justify-content: space-between;
  59. align-items: center;
  60. height: 80upx;
  61. padding: 0 $spacing-lg;
  62. background-color: $color-white;
  63. .oa-swiper {
  64. height: 100%;
  65. flex: 1;
  66. margin-left: 30upx;
  67. .oa-swiper-item {
  68. display: flex;
  69. justify-content: space-between;
  70. .text,
  71. .iconfont {
  72. height: 80upx;
  73. line-height: 80upx;
  74. }
  75. .iconfont {
  76. color: $font-color-light;
  77. }
  78. }
  79. }
  80. }
  81. </style>