12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import {
- getFansList
- } from '~/api/user'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- pageNo: 1,
- totalSize: 0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.getFansList()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- if (this.data.totalSize > this.data.list.length) {
- this.setData({
- pageNo: this.data.pageNo + 1
- })
- this.getFansList()
- }
- },
- async getFansList() {
- let {
- list,
- totalSize
- } = await getFansList({
- pageNo: this.data.pageNo,
- pageSize: 20
- })
- list = [...this.data.list, ...list]
- this.setData({
- list,
- totalSize
- })
- },
- jumpUserInfo({
- currentTarget
- }) {
- console.log(currentTarget.dataset);
- let uid = currentTarget.dataset.uid
- wx.navigateTo({
- url: `/pages/personal/index?uid=${uid}`,
- })
- }
- })
|