listModel.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view v-show="isShow" class="i-h-p100 i-flex i-al-center i-jst-center i-z-index3">
  3. <scroll-view ref="scrollView" scroll-y="true" :scroll-top="scrollTop" :show-scrollbar="false"
  4. class="i-h-p100 i-w-p100">
  5. <view class="i-flex i-al-center i-jst-center">
  6. <view class="i-w-p80 animate__animated"
  7. :class="pageStatus===1?'animate__fadeInUp':pageStatus===3?'animate__fadeOutDown':''">
  8. <view class="i-h-110"></view>
  9. <uni-row>
  10. <uni-col :span="6" v-for="(item,index) in list" :key="index">
  11. <view class="i-flex i-al-center i-jst-center i-mt-26">
  12. <view class="i-pst-r i-h-p70 i-w-p90" @click="toDetail(item)">
  13. <image class="i-radius-20 i-w-p100" :class="styleType === 1?'i-h-350':'i-h-250'"
  14. mode="aspectFill" :src="item.detail_img">
  15. </image>
  16. <view class="i-c-fff i-z-index1 i-pst-a i-t-center i-w-p100 i-t-p35">
  17. <view>
  18. <span class="i-fs-26">{{item.title}}</span>
  19. </view>
  20. <view class="i-mt-10">
  21. <span class="i-fs-20">{{item.subtitle}}</span>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </uni-col>
  27. </uni-row>
  28. <view class="i-h-400"></view>
  29. </view>
  30. </view>
  31. </scroll-view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: "listModel",
  37. data() {
  38. return {
  39. scrollTop: 0
  40. };
  41. },
  42. props: {
  43. isShow: {
  44. type: Boolean,
  45. default: false
  46. },
  47. list: {
  48. type: Array,
  49. default: () => ([])
  50. },
  51. // 页面状态 动画效果 1进入 2正常 3退出
  52. pageStatus: {
  53. type: Number,
  54. default: 1,
  55. },
  56. styleType: {
  57. type: Number,
  58. default: 1
  59. }
  60. },
  61. watch: {
  62. isShow(newVal) {
  63. if (newVal) {
  64. // 强制重置滚动位置
  65. this.scrollTop = 0; // 先设置为 0
  66. this.$nextTick(() => {
  67. this.scrollTop = 1; // 强制触发滚动
  68. this.$nextTick(() => {
  69. this.scrollTop = 0; // 再次设置为 0
  70. });
  71. });
  72. }
  73. }
  74. },
  75. methods: {
  76. toDetail(item) {
  77. if (item.have_detail === 1) {
  78. this.$emit('toDetailEvent', item)
  79. } else {
  80. }
  81. },
  82. }
  83. }
  84. </script>
  85. <style>
  86. </style>