list.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="list">
  3. <view class="item" v-for="(item, index) in list" :key="index" @click="select(item)">
  4. <view class="address">
  5. <view class="con">
  6. <view class="title omit">云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路36号云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路</view>
  7. <view class="desc">
  8. <text>陈晓东</text>
  9. <text>13481076556</text>
  10. </view>
  11. </view>
  12. <view class="icon">&#xe8f2;</view>
  13. <view class="clear"></view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. list: [{}, {}, {}, {}, {}],
  23. param: { pageNo: 1, pageSize: 10 },
  24. loadMore: true
  25. };
  26. },
  27. onLoad(e) {
  28. //this.getData();
  29. },
  30. methods: {
  31. getData() {
  32. this.http.request({
  33. url: '/level-one-server/app/TbPortNews/getPortNewsList',
  34. data: this.param,
  35. loading: 'false',
  36. success: res => {
  37. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  38. this.list.push(...res.data.data);
  39. }
  40. });
  41. },
  42. select(item) {
  43. uni.$emit('selectAddress', item);
  44. uni.navigateBack();
  45. },
  46. //刷新数据
  47. refresh() {
  48. this.loadMore = true;
  49. this.param.pageNo = 1;
  50. this.list = [];
  51. this.getData();
  52. }
  53. },
  54. //下拉刷新
  55. onPullDownRefresh() {
  56. setTimeout(() => {
  57. this.refresh();
  58. uni.stopPullDownRefresh();
  59. }, 1000);
  60. },
  61. //上拉加载
  62. onReachBottom() {
  63. if (this.loadMore) {
  64. this.param.pageNo++;
  65. this.getData();
  66. }
  67. },
  68. onNavigationBarButtonTap() {
  69. uni.navigateTo({ url: 'add' });
  70. }
  71. };
  72. </script>
  73. <style lang="scss">
  74. page {
  75. background-color: $pg;
  76. }
  77. .list {
  78. padding: 12px;
  79. .item {
  80. padding: 5px;
  81. color: $font-c;
  82. background-color: white;
  83. border-radius: 10px;
  84. margin-bottom: 10px;
  85. }
  86. }
  87. </style>