component3.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view>
  3. <view class="box1" v-for="(item,index) in list" :key="index">
  4. {{ item.name }}<text>{{ item.id }}</text>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import post from "../../../common/httpClient.js";
  10. export default {
  11. props: {},
  12. data: () => ({
  13. list: [
  14. { name: "aaaaaaa", id: 0 },
  15. { name: "bbbbbbb", id: 1 },
  16. { name: "ccccccc", id: 2 },
  17. { name: "ddddddd", id: 3 },
  18. { name: "eeeeeee", id: 4 },
  19. { name: "fffffff", id: 5 },
  20. { name: "ggggggg", id: 6 },
  21. ],
  22. }),
  23. computed: {},
  24. methods: {},
  25. watch: {},
  26. // 页面周期函数--监听页面加载
  27. onLoad() {
  28. },
  29. // 页面周期函数--监听页面初次渲染完成
  30. onReady() {},
  31. // 页面周期函数--监听页面显示(not-nvue)
  32. onShow() {},
  33. // 页面周期函数--监听页面隐藏
  34. onHide() {},
  35. // 页面周期函数--监听页面卸载
  36. onUnload() {},
  37. onPullDownRefresh() {
  38. // let that = this;
  39. // post({
  40. // server: 2,
  41. // servant: 1005,
  42. // data: {
  43. // phone: "3246541321",
  44. // type: 1,
  45. // verifyInfo: "asdasd",
  46. // },
  47. // })
  48. // .then((result) => {
  49. // //if (result.code === 0) {
  50. // let count = that.list.length
  51. // that.list.push({
  52. // name:result.msg,
  53. // id:count
  54. // })
  55. // //}
  56. // uni.stopPullDownRefresh();
  57. // })
  58. // .catch((err) => {
  59. // uni.stopPullDownRefresh();
  60. // });
  61. },
  62. onReachBottom(){
  63. let that = this;
  64. post({
  65. server: 2,
  66. servant: 1005,
  67. data: {
  68. phone: "3246541321",
  69. type: 1,
  70. verifyInfo: "asdasd",
  71. },
  72. })
  73. .then((result) => {
  74. let count = that.list.length
  75. that.list.push({
  76. name:result.msg,
  77. id:count
  78. })
  79. })
  80. .catch((err) => {
  81. });
  82. }
  83. };
  84. </script>
  85. <style lang="scss">
  86. @import url("./a.css");
  87. .box1 {
  88. width: 100vw;
  89. height: 200rpx;
  90. color: #353535;
  91. font-size: 50rpx;
  92. text {
  93. font-size: $fs-middel;
  94. color: red;
  95. }
  96. }
  97. </style>