部分浏览器回退上一页重新加载网页

部分浏览器返回上一页会重新加载这个页面,怎么弄返回上一页后不让他刷新

你要点开某个内容时,用鼠标中键点,它就会生成新的网页,原本的网页会保留

  • 你可以参考下这个问题的回答, 看看是否对你有帮助, 链接: https://ask.csdn.net/questions/7521053
  • 这篇博客你也可以参考下:微信小程序如何返回上一个页面并刷新上一个页面
  • 除此之外, 这篇博客: 微信小程序 还在为滑动加载数据烦劳吗? 封装滚动加载方法 看了就会中的 7:完整的页面&代码附上 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  •     7.1 getmore.wxml

    <!--pages/getmore/getmore.wxml-->
    <!-- winHeight 必须要获取当前手机的尺寸不染不会触动滑动事件 -->
    <scroll-view id="list" scroll-y="true"  style="height:{{winHeight-30}}px" bindscrolltolower='bindscrolltolower'>
      <view>
        <block wx:if="{{list.length>0}}">
          <block wx:for="{{list}}" wx:key="index">
            <!-- 设置高度为了显示滚动条 可以滑动 -->
            <view style="height:50px"> 
              <text>{{item}}</text>
            </view> 
          </block>
        </block>
      </view>
    </scroll-view>
    

    7.2 getmore.js

    // pages/getmore/getmore.js
    Page({
    
      /**
       * 页面的初始数据
       */
      data: {
        //默认(必须)
        currentPage: 1,//请求数据的页码
        size: 10,//每页数据条数
        totalCount: 0,//总是数据条数
        pagecount: 0,//总的页数
        //页面设置
        winWidth: 0,
        winHeight: 0,
        list:[],//你的数据源
      },
    
      /**
       * 生命周期函数--监听页面加载
       */
      onLoad: function (options) {
    
      },
    
      /**
       * 生命周期函数--监听页面初次渲染完成
       */
      onReady: function () {
    
      },
      /**
        * 获取页面高度和宽度
        */
      get_systime: function () {
        var that = this;
        wx.getSystemInfo({
          success: function (res) {
            that.setData({
              winWidth: res.windowWidth,
              winHeight: res.windowHeight
            });
          }
        });
      },
      /**
       * 生命周期函数--监听页面显示
       */
      onShow: function () {
        this.get_systime(); //获取手机屏幕高度宽度
        this.get_list(); //默认加载第一页数据
      },
    
      /**
       * 生命周期函数--监听页面隐藏
       */
      onHide: function () {
    
      },
    
      /**
       * 生命周期函数--监听页面卸载
       */
      onUnload: function () {
    
      },
    
      /**
       * 页面相关事件处理函数--监听用户下拉动作
       */
      onPullDownRefresh: function () {
    
      },
    
      /**
       * 页面上拉触底事件的处理函数
       */
      onReachBottom: function () {
    
      },
    
      /**
       * 用户点击右上角分享
       */
      onShareAppMessage: function () {
    
      },
      /**
       * demo获取数据
       */
      get_list: function () {
        let that = this;
    
        //下面的for循环是模拟请求数据方法
        var temlist = that.data.list; //原始的数据集合
        for(var i=0;i<10; i++){
          var currentPage = that.data.currentPage; //获取当前页码
          var size = that.data.size;//每页数据条数
          if (currentPage == 1) {
            temlist = temlist.concat("我是第"+i+"条数据记录"); //初始化数据列表
              currentPage = 1;
          } else {
              temlist = temlist.concat("我是第" + ((i + 1) + (currentPage - 1) * size) + "条数据记录"); //请求的数据追加到原始数据集合里
              currentPage = currentPage + 1;
          }
         }
          that.setData({
            currentPage: currentPage,
            list: temlist,
            totalCount: 100, //总的数据条数
            pagecount: 100 / that.data.size //总页数
          })
    
        // //下面方法是实际去请求数据地址和相关参数传递
        // var webData = {
        //   size: this.data.size,
        //   currentPage: this.data.currentPage,
        // }
        // var url = "get_evaluationDate";
        // base.getWebDataWithPostOrGet({
        //   url: url,
        //   param: webData,
        //   method: "POST",
        //   success: function (res) {
        //     if (res.data.status == "success") {
        //       var temlist = that.data.allceplist; //原始的数据集合
        //       var currentPage = that.data.currentPage; //获取当前页码
        //       if (currentPage == 1) {
        //         temlist = res.data.data; //初始化数据列表
        //         currentPage = 1;
        //       } else {
        //         temlist = temlist.concat(res.data.data); //请求的数据追加到原始数据集合里
        //         currentPage = currentPage + 1;
        //       }
        //       that.setData({
        //         currentPage: currentPage,
        //         allceplist: temlist,
        //         totalCount: res.data.totalCount, //总的数据条数
        //         pagecount: res.data.totalCount / that.data.size //总页数
        //       })
        //     } else {
        //       wx.showToast({
        //         title: res.data.status,
        //         icon: "error"
        //       })
        //     }
        //     //console.log(that.data.allceplist);
        //   }
        // })
      },
      /**
       * 加载更多数据
       */
      bindscrolltolower: function () {
        if (this.data.currentPage < this.data.pagecount) {
          this.data.currentPage++;
          this.get_list();
        } else {
          //没有更多数据
         this.nomore_showToast();
        }
      },
      /**
     * 没有更多数据
     * */
      nomore_showToast :function () {
        wx.showToast({
          title: '没有更多数据',
          icon: 'success',
          duration: 1500,
          mask: true
        })
      }
    })

    好了 到此为止滑动加载数据就完美的实现啦 如果你看了,对你有帮助就三连吧 谢谢

  • 您还可以看一下 吴刚老师的【吴刚大讲堂】电商应用界面设计课程中的 电商产品视觉界面设计需求与应用场景小节, 巩固相关知识点