index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <!-- 头条快报 -->
  3. <view class="diy-special" :style="{ padding: `${itemStyle.paddingTop}px 0`, background: itemStyle.background }">
  4. <view class="special-left" @click="handleNavMore()">
  5. <image class="image" mode="widthFix" :src="params.image" />
  6. </view>
  7. <div class="special-content" :class="[`display_${params.display}`]">
  8. <swiper :autoplay="true" :interval="1500" :duration="800" :circular="true" :vertical="true"
  9. :display-multiple-items="itemStyle.display">
  10. <swiper-item v-for="(dataItm, idx) in dataList" :key="idx">
  11. <view class="content-item oneline-hide" @click="handleNavDetail(dataItm.article_id)">
  12. <text :style="{ color: itemStyle.textColor }">{{ dataItm.title }}</text>
  13. </view>
  14. </swiper-item>
  15. </swiper>
  16. </div>
  17. <div class="special-more" @click="handleNavMore()">
  18. <text class="iconfont icon-arrow-right"></text>
  19. </div>
  20. </view>
  21. </template>
  22. <script>
  23. import mixin from '../mixin'
  24. export default {
  25. /**
  26. * 组件的属性列表
  27. * 用于组件自定义设置
  28. */
  29. props: {
  30. itemIndex: String,
  31. itemStyle: Object,
  32. params: Object,
  33. dataList: Array
  34. },
  35. mixins: [mixin],
  36. /**
  37. * 组件的方法列表
  38. * 更新属性和数据的方法与更新页面数据的方法类似
  39. */
  40. methods: {
  41. // 跳转到文章详情页
  42. handleNavDetail(articleId) {
  43. this.$navTo('pages/article/detail', { articleId })
  44. },
  45. // 跳转到更多
  46. handleNavMore() {
  47. this.$navTo('pages/article/index')
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. // diy-头条快报
  54. .diy-special {
  55. display: flex;
  56. align-items: center;
  57. line-height: normal;
  58. .special-left {
  59. padding: 10rpx 20rpx;
  60. .image {
  61. display: block;
  62. width: 140rpx;
  63. }
  64. }
  65. .special-content {
  66. flex: 1;
  67. overflow: hidden;
  68. .content-item {
  69. padding: 4rpx 0;
  70. font-size: 13px;
  71. color: #141414;
  72. }
  73. &.display_1 {
  74. height: 44rpx;
  75. }
  76. &.display_2 {
  77. height: 88rpx;
  78. }
  79. }
  80. .special-more {
  81. padding: 24rpx 20rpx;
  82. font-size: 24rpx;
  83. }
  84. }
  85. </style>