weui / react-weui

weui for react
https://weui.github.io/react-weui/docs/
2.85k stars 493 forks source link

请问SerchBar如何实现下拉刷新? #329

Open lyndon1115 opened 3 years ago

lyndon1115 commented 3 years ago

Do you want to request a feature or report a bug (建议还是bug) ? 建议 What is the current behavior? (现有状况) let currentPage = null let totalPage = null ` search: function (value) { if(!currentPage) currentPage = 1; searchValue = value;

  return new Promise((resolve, reject) => {
      //setTimeout(() => {
          wx.request({
            url: getApp().data.basePath + '/search-' + value + '-1-' + currentPage + '.htm',
            success: (data) => {
              console.log('search', data.data);
              totalPage = data.data.message.totalpage;
              console.log('search searchResultList before', searchResultList);
              console.log('search searchResultList threadlist', searchResultList);
              if(searchResultList)
                searchResultList = searchResultList.concat(data.data.message.threadlist);
              else searchResultList = data.data.message.threadlist;
              console.log('search searchResultList after', searchResultList);
              resolve(searchResultList)
            }
          })
     // }, 200)
  })

}, onReachBottom () { console.log('onReachBottom currentPage ', currentPage); console.log('onReachBottom totalPage ', totalPage); var that = this; if (currentPage && totalPage) { if( currentPage < totalPage){ currentPage += currentPage; that.search.then(that.search(searchValue)); } }` 搜索结果分页,第一次搜索结果为前10,上拉(onReachBottom)以后出发请求第二页搜索结果,然后追加展示。但是现在追加结果没有反应。 What is the expected behavior? (应有状况) 第二页搜索结果追加到搜索结果列表。 Which versions of React-weui, weui, and which OS and device are affected by this issue? (React-weui版本 weui版本 机型和系统) 全机型。