topiclist.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="main">
  3. <navigator v-for="(item, index) in pageList" :key="index" :url="'/pages/topic/topic?id=' + item.id" hover-class="none" class="li dflex">
  4. <view class="ztdiv">
  5. <view class="imgdiv">
  6. <image :src="item.pic+ '?x-oss-process=style/w750-auto'" class="t-img"></image>
  7. </view>
  8. <view class="txtdiv">
  9. <text>{{item.title}}</text>
  10. </view>
  11. </view>
  12. </navigator>
  13. </view>
  14. </template>
  15. <script>
  16. // pages/topicList/topiclist.js
  17. // pages/topic/topic.js
  18. const app = getApp();
  19. const req = require("../../utils/request.js");
  20. export default {
  21. data() {
  22. return {
  23. page: 1,
  24. pageList: [],
  25. bannerList: [],
  26. swiperCurrent: 0,
  27. isLoad: true,
  28. hasmore: true,
  29. isRuleTrue: false,
  30. //筛选是否显示
  31. styletype: 0
  32. };
  33. },
  34. components: {},
  35. props: {},
  36. /**
  37. * 生命周期函数--监听页面加载
  38. */
  39. onLoad: function (options) {
  40. this.getList();
  41. },
  42. /**
  43. * 生命周期函数--监听页面初次渲染完成
  44. */
  45. onReady: function () {},
  46. /**
  47. * 生命周期函数--监听页面显示
  48. */
  49. onShow: function () {},
  50. /**
  51. * 生命周期函数--监听页面隐藏
  52. */
  53. onHide: function () {},
  54. /**
  55. * 生命周期函数--监听页面卸载
  56. */
  57. onUnload: function () {},
  58. /**
  59. * 页面相关事件处理函数--监听用户下拉动作
  60. */
  61. onPullDownRefresh: function () {},
  62. /**
  63. * 页面上拉触底事件的处理函数
  64. */
  65. onReachBottom: function () {},
  66. methods: {
  67. getList() {
  68. let that = this;
  69. // console.log(that.isLoad);
  70. if (!that.isLoad) return false;
  71. that.isLoad = false;
  72. let form = {
  73. page: 1,
  74. limit: 10 //searchTitle: that.data.searchTitle,
  75. //sort: that.data.sort,
  76. //attr: that.data.attr,
  77. //categoryId: that.data.categoryId
  78. };
  79. req.getRequest('/api/special/list', form, data => {
  80. // console.log(data);
  81. if (data && data.length >= 10) that.isLoad = true;
  82. if (that.page > 1) data = that.pageList.concat(data);
  83. if (data) {
  84. that.setData({
  85. pageList: data
  86. });
  87. }
  88. });
  89. }
  90. }
  91. };
  92. </script>
  93. <style>
  94. @import "./topiclist.css";
  95. </style>