{"id":33391,"date":"2024-11-25T17:36:41","date_gmt":"2024-11-25T09:36:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33391\/"},"modified":"2024-11-25T17:36:41","modified_gmt":"2024-11-25T09:36:41","slug":"%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%9a%84%e4%b8%8b%e6%8b%89%e5%88%b7%e6%96%b0%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33391\/","title":{"rendered":"\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898"},"content":{"rendered":"<p>\u5728\u5c0f\u7a0b\u5e8f\u4e2donload\u751f\u547d\u94a9\u5b50\u53ea\u5728\u9875\u9762\u521b\u5efa\u65f6\u8c03\u7528\u4e00\u6b21\uff0c\u5728\u505anavigateto\u9875\u9762\u8df3\u8f6c\u540e\uff0c\u8fd4\u56de\u4e0a\u7ea7\u9875\u9762\uff0c\u7531\u4e8enavigateto\u8df3\u8f6c\u53ea\u662f\u9690\u85cf\u4e86\u5f53\u524d\u9875\u9762\uff0c\u56e0\u6b64\u8fd4\u56de\u4e0a\u4e00\u7ea7\u9875\u9762\u65f6onload\u751f\u547d\u94a9\u5b50\u4e0d\u4f1a\u518d\u6b21\u6267\u884c\uff0c\u8fd9\u6837\u5e26\u6765\u7684\u597d\u5904\u662f\u9875\u9762\u80fd\u5feb\u901f\u5c55\u793a\u51fa\u6765\uff0c\u4f46\u662fonload\u4e2d\u7684\u8bf7\u6c42\u6570\u636e\u4e0d\u4f1a\u5b9e\u65f6\u66f4\u65b0\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u4e00\u4e2a\u4e0b\u62c9\u5237\u65b0\u7684\u64cd\u4f5c\u6765\u5e2e\u52a9\u7528\u624b\u52a8\u66f4\u65b0\u9875\u9762\u6570\u636e\uff0c\u63a5\u4e0b\u6765\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4f1a\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u4e2d\u5b9e\u73b0\u4e0b\u62c9\u5237\u65b0\u7684\u4e09\u79cd\u65b9\u5f0f<\/p>\n<h2><span style=\"font-size: 14px\">enablePullDownRefresh<\/span><\/h2>\n<p>enablePullDownRefresh\u662f\u6700\u5bb9\u6613\u5b9e\u73b0\u4e0b\u62c9\u5237\u65b0\u7684\u65b9\u6cd5\uff0c\u5728json\u6587\u4ef6\u4e2d\u5c06enablePullDownRefresh\u8bbe\u7f6e\u4e3atrue\uff0c\u5728Page\u4e2d\u76d1\u542conPullDownRefresh\u4e8b\u4ef6\u5373\u53ef\uff0c\u652f\u6301\u70b9\u51fb\u9876\u90e8\u6807\u9898\u680f\u56de\u5230\u9876\u90e8\uff0c\u81ea\u5b9a\u4e49\u6807\u9898\u680f\u65f6\u4f1a\u5931\u6548\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u8c03\u7528wx.startPullDownRefresh()\u89e6\u53d1\u4e0b\u62c9\u5237\u65b0\u4e8b\u4ef6\uff0c\u4ea7\u751f\u4e0b\u62c9\u5237\u65b0\u52a8\u753b\uff0c\u5904\u7406\u5b8c\u4e0b\u62c9\u5237\u65b0\u4e2d\u7684\u6570\u636e\u66f4\u65b0\u540e\u8c03\u7528wx.stopPullDownRefresh()\u7ed3\u675f\u52a8\u753b\u5373\u53ef\u3002<\/p>\n<p>\u8fd9\u79cd\u5f62\u5f0f\u7684\u4e0b\u62c9\u5237\u65b0\u7684\u4f18\u70b9\u5f88\u660e\u663e\u5c31\u662f\u7b80\u5355\uff0c\u6ca1\u6709\u9650\u5236\uff0c\u4f46\u662f\u7f3a\u70b9\u4e5f\u540c\u6837\u660e\u663e\uff1a<\/p>\n<ul>\n<li><span style=\"font-size: 14px\">\u4e0b\u62c9\u52a8\u753b\u592a\u8fc7\u7b80\u5355\uff0c\u4ea4\u4e92\u4e0d\u591f\u4f18\u96c5\u4e14\u4e0d\u80fd\u81ea\u5b9a\u4e49\u4e0b\u62c9\u52a8\u753b<\/span><\/li>\n<li><span style=\"font-size: 14px\">\u5f53\u81ea\u5b9a\u4e49\u6807\u9898\u680f\u65f6\uff0cfixed\u5b9a\u4f4d\uff0c\u5728Android\u4e0b\u6807\u9898\u680f\u4e5f\u4f1a\u88ab\u4e00\u8d77\u4e0b\u62c9<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-size: 14px\">scroll-view<\/span><\/h2>\n<p>scroll-view\u662f\u5b98\u65b9\u7684\u4e00\u4e2a\u6eda\u52a8\u89c6\u56fe\u7ec4\u4ef6\uff0c\u4f7f\u7528\u5f88\u7b80\u5355\uff0c\u60f3\u8981\u8bbe\u7f6e\u4e0a\u62c9\u5237\u65b0\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;scroll-view class=\"scroll\" scroll-y bindscrolltoupper=\"refresh\"&gt;\n  &lt;view class=\"content\"&gt;content&lt;\/view&gt;\n&lt;\/scroll-view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u60f3\u8981\u5229\u7528scroll-view\u5b9e\u73b0\u4e0a\u62c9\u5237\u65b0\uff0c\u9700\u8981\u6ce8\u610f\uff1a<\/p>\n<ul>\n<li><span style=\"font-size: 14px\">\u4e00\u5b9a\u8981\u7ed9scroll-view\u8bbe\u7f6e\u56fa\u5b9a\u9ad8\u5ea6\uff0c\u5426\u5219\u76d1\u542c\u4e8b\u4ef6\u4e0d\u4f1a\u89e6\u53d1<\/span><\/li>\n<li><span style=\"font-size: 14px\">\u8bbe\u7f6e\u7eb5\u5411\u6eda\u52a8scroll-y<\/span><\/li>\n<li><span style=\"font-size: 14px\">scroll-view\u5185\u7684\u5185\u5bb9\u9ad8\u5ea6\u4e00\u5b9a\u8981\u6bd4scroll-view\u9ad8\u5ea6\u8981\u9ad8\uff0c\u5426\u5219\u65e0\u6cd5\u4ea7\u751f\u7eb5\u5411\u6eda\u52a8\uff0c\u5c31\u65e0\u6cd5\u89e6\u53d1\u76d1\u542c\u4e8b\u4ef6<\/span><\/li>\n<\/ul>\n<p>scroll-view\u7f3a\u70b9\uff1a<\/p>\n<ul>\n<li><span style=\"font-size: 14px\">\u7531\u4e8eiOS\u6709\u6a61\u76ae\u7b4b\u6548\u679c\uff0c\u56e0\u6b64\u6700\u7ec8\u6548\u679c\u4f1a\u4e0eAndroid\u6709\u4e00\u5b9a\u7684\u5dee\u5f02<\/span><\/li>\n<li><span style=\"font-size: 14px\">\u521a\u6253\u5f00\u9875\u9762\u65f6\u4e0a\u62c9\u662f\u65e0\u6cd5\u89e6\u53d1\u4e0a\u62c9\u76d1\u542c\u4e8b\u4ef6\uff0c\u9700\u8981\u5148\u5411\u4e0b\u6eda\u52a8\uff0c\u89e6\u53d1\u6eda\u52a8\uff0c\u7136\u540e\u518d\u4e0a\u62c9\u6eda\u52a8\u624d\u80fd\u89e6\u53d1\u76d1\u542c\u4e8b\u4ef6<\/span><\/li>\n<li><span style=\"font-size: 14px\">\u5f53\u6709\u81ea\u5b9a\u4e49\u5934\u90e8\u65f6\uff0cscroll-view\u9700\u8981\u4e00\u4e2a\u9ad8\u5ea6\u8ba1\u7b97\uff0c\u51cf\u53bb\u5934\u90e8\u9ad8\u5ea6<\/span><\/li>\n<\/ul>\n<p>scroll-view\u4f18\u70b9\uff1a<\/p>\n<ul>\n<li><span style=\"font-size: 14px\">\u53ef\u4ee5\u81ea\u5b9a\u4e49\u52a0\u8f7d\u52a8\u753b<\/span><\/li>\n<li><span style=\"font-size: 14px\">\u4ee3\u7801\u76f8\u5bf9\u7b80\u5355<\/span><\/li>\n<li>\n<p><span style=\"font-size: 14px\">\u76f8\u5bf9enablePullDownRefresh\uff0cscroll-view\u5bf9\u6eda\u52a8\u5217\u8868\u63a7\u5236\u66f4\u52a0\u65b9\u4fbf\uff1a<\/span><\/p>\n<ul>\n<li><span style=\"font-size: 14px\">scroll-into-view\uff1a\u6eda\u52a8\u5230\u6307\u5b9a\u5143\u7d20<\/span><\/li>\n<li><span style=\"font-size: 14px\">enable-back-to-top\uff1aiOS\u70b9\u51fb\u9876\u90e8\u72b6\u6001\u680f\u3001\u5b89\u5353\u53cc\u51fb\u6807\u9898\u680f\u65f6\uff0c\u6eda\u52a8\u6761\u8fd4\u56de\u9876\u90e8\uff0c\u53ea\u652f\u6301\u7ad6\u5411\uff0c\u4e14\u5f53\u81ea\u5b9a\u4e49\u6807\u9898\u680f\u540e\u5c31\u4f1a\u5931\u6548<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5b98\u65b9\u5e76\u4e0d\u63a8\u8350\u4f7f\u7528scroll-view\u505a\u4e0b\u62c9\u5237\u65b0\uff0c\u5b98\u65b9\u6587\u6863\u4e0a\u6709\u8fd9\u6837\u4e00\u4e2atip<br \/><span><\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/397\/981\/996\/1592795587610571.png\" class=\"aligncenter\" title=\"\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898\u63d2\u56fe\" alt=\"\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898\u63d2\u56fe\" \/><\/p>\n<h2><span style=\"font-size: 14px\">\u81ea\u5b9a\u4e49\u4e0b\u62c9\u5237\u65b0<\/span><\/h2>\n<p>\u81ea\u5b9a\u4e49\u4e0b\u62c9\u5237\u65b0\u6700\u4e3b\u8981\u5e0c\u671b\u89e3\u51b3\u7684\u95ee\u9898\u8fd8\u662f\u5728Android\u4f7f\u7528enablePullDownRefresh\u65f6fixed\u5b9a\u4f4d\u7684\u6807\u9898\u680f\u6216\u5bfc\u822a\u680f\u4f1a\u88ab\u4e0b\u62c9\u7684\u95ee\u9898\uff0c\u540c\u65f6\u4e24\u7aef\u5728\u4e0b\u62c9\u5237\u65b0\u65f6\u7684\u52a8\u753b\u4fdd\u6301\u4e00\u81f4\uff0c\u5176\u5b9e\u5b9e\u73b0\u8d77\u6765\u5e76\u4e0d\u96be\uff0c\u63a5\u4e0b\u6765\u5c31\u770b\u770b\u5177\u4f53\u5b9e\u73b0:<br \/>wxml:<\/p>\n<pre>&lt;view class=\"scroll\" bindtouchstart=\"touchStart\" bindtouchmove=\"touchMove\" bindtouchend=\"touchEnd\"&gt;\n  &lt;view class=\"animation\"&gt;\n    &lt;view class=\"loading\"&gt;&lt;\/view&gt;\n    &lt;text class=\"tip\"&gt;{{state === 0 ? '\u4e0b\u62c9\u5237\u65b0' : state === 1? '\u677e\u5f00\u5237\u65b0' : '\u5237\u65b0\u4e2d'}}&lt;\/text&gt;\n  &lt;\/view&gt;\n  &lt;view style=\"transform: translateY({{translateHeight}}rpx)\"&gt;\n    &lt;slot name=\"content\"&gt;&lt;\/slot&gt;\n  &lt;\/view&gt;\n&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u4e2a\u6587\u4ef6\u5b9a\u4e49\u7ec4\u4ef6\u7684\u6a21\u7248\uff0c\u6709\u4e00\u4e2a\u6eda\u52a8view\u5305\u88f9\uff0c\u7ed1\u5b9a\u4e86touch\u4e8b\u4ef6\uff0c\u91cc\u9762\u5305\u542b\u4e0b\u62c9\u5237\u65b0\u65f6\u7684\u52a8\u753b\uff0c\u548c\u4e00\u4e2aslot\uff0cslot\u7528\u4e8e\u63d2\u5165\u6eda\u52a8\u5217\u8868\u7684\u5185\u5bb9<br \/>wxss:<\/p>\n<pre>.animation {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  width: 100%;\n  height: 150rpx;\n  margin-bottom: -150rpx;\n  background-color: #fff;\n}\n.loading {\n  width: 30rpx;\n  height: 30rpx;\n  border:6rpx solid #333333;\n  border-bottom: #cccccc 6rpx solid;\n  border-radius: 50%;\n  animation:load 1.1s infinite linear;\n      \n}\n@keyframes load{ \n  from{\n    transform: rotate(0deg);\n  }\n  to{\n    transform: rotate(360deg);\n  }\n}\n\n.tip {\n  margin-left: 10rpx;\n  color: #666;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6837\u5f0f\u6587\u4ef6\u8fd9\u6ca1\u4ec0\u4e48\u7279\u522b\u7684<br \/>js:<\/p>\n<pre>let lastY = 0 \/\/ \u4e0a\u4e00\u6b21\u6eda\u52a8\u7684\u4f4d\u7f6e\nlet scale = 750 \/ wx.getSystemInfoSync().windowWidth \/\/ rpx\u8f6c\u5316\u6bd4\u4f8b\nComponent({\n  options: {\n    multipleSlots: true\n  },\n  data: {\n    scrollTop: 0,\n    translateHeight: 0, \/\/ \u5e73\u79fb\u8ddd\u79bb\n    state: -1\n  },\n  properties: {\n    \/\/ \u89e6\u53d1\u4e0b\u62c9\u5237\u65b0\u7684\u8ddd\u79bb\n    upperDistance: {\n      type: Number,\n      value: 150\n    }\n  },\n  methods: {\n    \/\/ \u76d1\u542c\u6eda\u52a8\uff0c\u83b7\u53d6scrollTop\n    onPageScroll (e) {\n      this.data.scrollTop = e.scrollTop\n    },\n    touchStart (e) {\n      lastY = e.touches[0].clientY\n    },\n    touchMove (e) {\n      let clientY = e.touches[0].clientY\n      let offset = clientY - lastY\n      if (this.data.scrollTop &gt; 0 || offset &lt; 0) return\n      this.data.translateHeight += offset\n      this.data.state = 0\n      lastY = e.touches[0].clientY\n      if (this.data.translateHeight - this.data.scrollTop * scale &gt; this.data.upperDistance) {\n        this.data.state = 1\n      }\n      this.setData({\n        translateHeight: this.data.translateHeight,\n        state: this.data.state\n      })\n    },\n    touchEnd (e) {\n      if (this.data.translateHeight - this.data.scrollTop * scale &gt; this.data.upperDistance) {\n        this.setData({\n          translateHeight: 150\n        })\n        this.triggerEvent('scrolltoupper')\n        this.setData({\n          state: 2\n        })\n      } else if (this.data.scrollTop &lt;= 0) {\n        this.stopRefresh()\n      }\n    },\n    \/\/  \u505c\u6b62\u5237\u65b0\n    stopRefresh () {\n      this.setData({\n        translateHeight: 0,\n        state: -1\n      }, () =&gt; {\n        wx.pageScrollTo({\n          scrollTop: 0,\n          duration: 0\n        })\n      })\n    }\n  }\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u4e2a\u4e0b\u62c9\u5237\u65b0\u7ec4\u4ef6\u6700\u91cd\u8981\u7684\u662f\u63a7\u5236\u4e0b\u62c9\u5237\u65b0\u7684\u65f6\u673a\uff0c\u4ee3\u7801\u4f53\u73b0\u5c31\u662f\u5b9a\u4e49\u4e86\u4e00\u4e2aupperDistance\uff0c\u4e0b\u62c9\u5237\u65b0\u7684\u8ddd\u79bb\u6765\u5224\u65ad\u662f\u5426\u6267\u884c\u5237\u65b0\u3002\u624b\u6307\u6ed1\u52a8\u65f6\uff0c\u83b7\u53d6\u6ed1\u52a8\u8ddd\u79bb\uff0ctranslateHeight\u7d2f\u52a0\u7528\u4e8e\u5c55\u793a\uff0c\u5728touchEnd\u4e8b\u4ef6\u4e2d\u5224\u65ad\u6ed1\u52a8\u8ddd\u79bb\u662f\u5426\u8fbe\u5230\u8bbe\u5b9a\u503c\uff0c\u8fbe\u5230\u8bbe\u5b9a\u503c\u5c31\u53d1\u9001scrolltoupper\u4e8b\u4ef6\uff0c\u5728\u7236\u7ec4\u4ef6\u4e2d\u76d1\u542c\u5373\u53ef\uff0c\u5426\u5219\u505c\u6b62\u5237\u65b0\u3002<\/p>\n<h4>\u4f7f\u7528\uff1a<\/h4>\n<pre>&lt;header title=\"\u4e0b\u62c9\u5237\u65b0\" background=\"#fff\"&gt;&lt;\/header&gt;\n&lt;refresh-scroll id=\"refreshScroll\" bindscrolltoupper=\"refresh\"&gt;\n  &lt;view class=\"item\" slot=\"content\" wx:for=\"{{list}}\"&gt;{{item}}&lt;\/view&gt;\n&lt;\/refresh-scroll&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>Page({\n  data: {\n    list: []\n  },\n  onLoad: function () {\n    this.refreshScroll = this.selectComponent('#refreshScroll')\n    for (let i = 0; i &lt; 10; i++) {\n      this.data.list.push(i)\n    }\n    this.setData({\n      list: this.data.list\n    })\n  },\n  onPageScroll (e) {\n    this.refreshScroll.onPageScroll(e)\n  },\n  onReachBottom () {\n    wx.showLoading({\n      title: 'onReachBottom'\n    })\n    setTimeout(() =&gt; {\n      wx.hideLoading()\n    }, 1000)\n  },\n  refresh: function (e) {\n    setTimeout(() =&gt; {\n      this.refreshScroll.stopRefresh()\n    }, 1000)\n  }\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u4f7f\u7528\u65f6\u5173\u952e\u662f\u8981\u5c06\u9875\u9762\u4e2donPageScroll\u4e2d\u83b7\u53d6\u7684\u503c\u4f20\u9012\u4e0b\u53bb\uff0c\u7136\u540ebindscrolltoupper\u76d1\u542cscrolltoupper\u4e8b\u4ef6\uff0c\u6267\u884c\u5237\u65b0\u64cd\u4f5c\u7136\u540e\u518d\u8c03\u7528stopRefresh\u505c\u6b62\u5237\u65b0\uff0c\u4e0b\u6765\u770b\u771f\u673a\u4e0a\u7684\u6d4b\u8bd5\u6548\u679c\uff1a<\/p>\n<p>iOS:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/681\/802\/936\/1592795626836878.gif\" class=\"aligncenter\" title=\"\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898\u63d2\u56fe1\" alt=\"\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898\u63d2\u56fe1\" \/><\/p>\n<p>Android:<br \/><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/613\/945\/926\/1592795671311322.gif\" class=\"aligncenter\" title=\"\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898\u63d2\u56fe2\" alt=\"\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898\u63d2\u56fe2\" \/><\/p>\n<p>\u5728\u771f\u673a\u6d4b\u8bd5\u65f6\uff0c\u8868\u73b0\u90fd\u8fd8\u4e0d\u9519\uff0c\u5f53\u7136\u4e86\uff0c\u8fd9\u53ea\u662f\u81ea\u5b9a\u4e49\u4e0b\u62c9\u5237\u65b0\u7684\u4e00\u4e2a\u7b80\u5355\u7ec4\u4ef6\u4f8b\u5b50\uff0c\u5982\u679c\u9700\u8981\u7528\u4e8e\u5230\u5b9e\u9645\u9879\u76ee\uff0c\u53ef\u80fd\u8fd8\u9700\u8981\u81ea\u5df1\u53bb\u5b8c\u5584\uff0c\u6bd5\u7adf\u4e0d\u540c\u7684\u4eba\u5e94\u7528\u7684\u573a\u666f\u4e0d\u540c\uff0c\u8fd9\u91cc\u53ea\u662f\u7ed9\u51fa\u4e86\u4e00\u4e2a\u601d\u8def\u800c\u5df2<\/p>\n<h2><span style=\"font-size: 14px\">\u603b\u7ed3<\/span><\/h2>\n<p>\u672c\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86\u5c0f\u7a0b\u5e8f\u4e0b\u62c9\u5237\u65b0\u65f6\u7684\u4e09\u79cd\u65b9\u6cd5\uff0c\u524d\u4e24\u79cd\u90fd\u662f\u5c0f\u7a0b\u5e8f\u5b98\u65b9\u63d0\u4f9b\u7684\uff0c\u6700\u540e\u4e00\u79cd\u662f\u4e2a\u4eba\u7684\u601d\u8003\u603b\u7ed3\uff0c\u5199\u7684\u4e5f\u6bd4\u8f83\u7b80\u5355\uff0c\u60f3\u8981\u9879\u76ee\u5e94\u7528\uff0c\u8fd8\u9700\u8981\u81ea\u5df1\u5b8c\u5584\uff0c\u53ea\u5e0c\u671b\u4e3a\u5927\u5bb6\u505a\u81ea\u5b9a\u4e49\u4e0b\u62c9\u5237\u65b0\u63d0\u4f9b\u4e00\u4e2a\u601d\u8def\u3002<\/p>\n<p>\u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5c0f\u7a0b\u5e8f\u7684\u4e0b\u62c9\u5237\u65b0\u95ee\u9898\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5c0f\u7a0b\u5e8f\u4e2donload\u751f\u547d\u94a9\u5b50\u53ea\u5728\u9875\u9762\u521b\u5efa\u65f6\u8c03\u7528\u4e00\u6b21\uff0c\u5728\u505anavigateto\u9875\u9762\u8df3\u8f6c\u540e\uff0c\u8fd4\u56de\u4e0a\u7ea7\u9875\u9762\uff0c\u7531\u4e8enavigateto\u8df3\u8f6c\u53ea\u662f\u9690\u85cf\u4e86\u5f53\u524d\u9875\u9762\uff0c\u56e0\u6b64\u8fd4\u56de\u4e0a\u4e00\u7ea7\u9875\u9762\u65f6onload\u751f\u547d\u94a9\u5b50\u4e0d\u4f1a\u518d\u6b21\u6267\u884c\uff0c\u8fd9\u6837\u5e26\u6765\u7684\u597d\u5904\u662f\u9875\u9762\u80fd\u5feb\u901f\u5c55\u793a\u51fa\u6765\uff0c\u4f46\u662fonload\u4e2d\u7684\u8bf7\u6c42\u6570\u636e\u4e0d\u4f1a\u5b9e\u65f6\u66f4\u65b0\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u4e00\u4e2a\u4e0b\u62c9\u5237\u65b0\u7684\u64cd\u4f5c\u6765\u5e2e\u52a9\u7528\u624b\u52a8\u66f4\u65b0\u9875\u9762\u6570\u636e\uff0c\u63a5\u4e0b\u6765\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4f1a\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u4e2d\u5b9e\u73b0\u4e0b\u62c9\u5237\u65b0\u7684\u4e09\u79cd\u65b9\u5f0f enablePullDownRefresh enablePullDownRefresh\u662f\u6700\u5bb9\u6613\u5b9e\u73b0\u4e0b\u62c9\u5237\u65b0\u7684\u65b9\u6cd5\uff0c\u5728json\u6587\u4ef6\u4e2d\u5c06enablePullDownRefresh\u8bbe\u7f6e\u4e3atrue\uff0c\u5728Page\u4e2d\u76d1\u542conPullDownRefresh\u4e8b\u4ef6\u5373\u53ef\uff0c\u652f\u6301\u70b9\u51fb\u9876\u90e8\u6807\u9898\u680f\u56de\u5230\u9876\u90e8\uff0c\u81ea\u5b9a\u4e49\u6807\u9898\u680f\u65f6\u4f1a\u5931\u6548\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u8c03\u7528wx.startPullDownRefresh()\u89e6\u53d1\u4e0b\u62c9\u5237\u65b0\u4e8b\u4ef6\uff0c\u4ea7\u751f\u4e0b\u62c9\u5237\u65b0\u52a8\u753b\uff0c\u5904\u7406\u5b8c\u4e0b\u62c9\u5237\u65b0\u4e2d\u7684\u6570\u636e\u66f4\u65b0\u540e\u8c03\u7528wx.stopPullDownRefresh()\u7ed3\u675f\u52a8\u753b\u5373\u53ef\u3002 \u8fd9\u79cd\u5f62\u5f0f\u7684\u4e0b\u62c9\u5237\u65b0\u7684\u4f18\u70b9\u5f88\u660e\u663e\u5c31\u662f\u7b80\u5355\uff0c\u6ca1\u6709\u9650\u5236\uff0c\u4f46\u662f\u7f3a\u70b9\u4e5f\u540c\u6837\u660e\u663e\uff1a \u4e0b\u62c9\u52a8\u753b\u592a\u8fc7\u7b80\u5355\uff0c\u4ea4\u4e92\u4e0d\u591f\u4f18\u96c5\u4e14\u4e0d\u80fd\u81ea\u5b9a\u4e49\u4e0b\u62c9\u52a8\u753b \u5f53\u81ea\u5b9a\u4e49\u6807\u9898\u680f\u65f6\uff0cfixed\u5b9a\u4f4d\uff0c\u5728Android\u4e0b\u6807\u9898\u680f\u4e5f\u4f1a\u88ab\u4e00\u8d77\u4e0b\u62c9 scroll-view scroll-view\u662f\u5b98\u65b9\u7684\u4e00\u4e2a\u6eda\u52a8\u89c6\u56fe\u7ec4\u4ef6\uff0c\u4f7f\u7528\u5f88\u7b80\u5355\uff0c\u60f3\u8981\u8bbe\u7f6e\u4e0a\u62c9\u5237\u65b0\u4ee3\u7801\u5982\u4e0b\uff1a &lt;scroll-view class=&#8221;scroll&#8221; scroll-y bindscrolltoupper=&#8221;refresh&#8221;&gt; &lt;view class=&#8221;content&#8221;&gt;content&lt;\/view&gt; &lt;\/scroll-view&gt; \u767b\u5f55\u540e\u590d\u5236 \u60f3\u8981\u5229\u7528scroll-view\u5b9e\u73b0\u4e0a\u62c9\u5237\u65b0\uff0c\u9700\u8981\u6ce8\u610f\uff1a \u4e00\u5b9a\u8981\u7ed9scroll-view\u8bbe\u7f6e\u56fa\u5b9a\u9ad8\u5ea6\uff0c\u5426\u5219\u76d1\u542c\u4e8b\u4ef6\u4e0d\u4f1a\u89e6\u53d1 \u8bbe\u7f6e\u7eb5\u5411\u6eda\u52a8scroll-y scroll-view\u5185\u7684\u5185\u5bb9\u9ad8\u5ea6\u4e00\u5b9a\u8981\u6bd4scroll-view\u9ad8\u5ea6\u8981\u9ad8\uff0c\u5426\u5219\u65e0\u6cd5\u4ea7\u751f\u7eb5\u5411\u6eda\u52a8\uff0c\u5c31\u65e0\u6cd5\u89e6\u53d1\u76d1\u542c\u4e8b\u4ef6 scroll-view\u7f3a\u70b9\uff1a \u7531\u4e8eiOS\u6709\u6a61\u76ae\u7b4b\u6548\u679c\uff0c\u56e0\u6b64\u6700\u7ec8\u6548\u679c\u4f1a\u4e0eAndroid\u6709\u4e00\u5b9a\u7684\u5dee\u5f02 \u521a\u6253\u5f00\u9875\u9762\u65f6\u4e0a\u62c9\u662f\u65e0\u6cd5\u89e6\u53d1\u4e0a\u62c9\u76d1\u542c\u4e8b\u4ef6\uff0c\u9700\u8981\u5148\u5411\u4e0b\u6eda\u52a8\uff0c\u89e6\u53d1\u6eda\u52a8\uff0c\u7136\u540e\u518d\u4e0a\u62c9\u6eda\u52a8\u624d\u80fd\u89e6\u53d1\u76d1\u542c\u4e8b\u4ef6 \u5f53\u6709\u81ea\u5b9a\u4e49\u5934\u90e8\u65f6\uff0cscroll-view\u9700\u8981\u4e00\u4e2a\u9ad8\u5ea6\u8ba1\u7b97\uff0c\u51cf\u53bb\u5934\u90e8\u9ad8\u5ea6 scroll-view\u4f18\u70b9\uff1a \u53ef\u4ee5\u81ea\u5b9a\u4e49\u52a0\u8f7d\u52a8\u753b \u4ee3\u7801\u76f8\u5bf9\u7b80\u5355 \u76f8\u5bf9enablePullDownRefresh\uff0cscroll-view\u5bf9\u6eda\u52a8\u5217\u8868\u63a7\u5236\u66f4\u52a0\u65b9\u4fbf\uff1a scroll-into-view\uff1a\u6eda\u52a8\u5230\u6307\u5b9a\u5143\u7d20 enable-back-to-top\uff1aiOS\u70b9\u51fb\u9876\u90e8\u72b6\u6001\u680f\u3001\u5b89\u5353\u53cc\u51fb\u6807\u9898\u680f\u65f6\uff0c\u6eda\u52a8\u6761\u8fd4\u56de\u9876\u90e8\uff0c\u53ea\u652f\u6301\u7ad6\u5411\uff0c\u4e14\u5f53\u81ea\u5b9a\u4e49\u6807\u9898\u680f\u540e\u5c31\u4f1a\u5931\u6548 \u5b98\u65b9\u5e76\u4e0d\u63a8\u8350\u4f7f\u7528scroll-view\u505a\u4e0b\u62c9\u5237\u65b0\uff0c\u5b98\u65b9\u6587\u6863\u4e0a\u6709\u8fd9\u6837\u4e00\u4e2atip \u81ea\u5b9a\u4e49\u4e0b\u62c9\u5237\u65b0 \u81ea\u5b9a\u4e49\u4e0b\u62c9\u5237\u65b0\u6700\u4e3b\u8981\u5e0c\u671b\u89e3\u51b3\u7684\u95ee\u9898\u8fd8\u662f\u5728Android\u4f7f\u7528enablePullDownRefresh\u65f6fixed\u5b9a\u4f4d\u7684\u6807\u9898\u680f\u6216\u5bfc\u822a\u680f\u4f1a\u88ab\u4e0b\u62c9\u7684\u95ee\u9898\uff0c\u540c\u65f6\u4e24\u7aef\u5728\u4e0b\u62c9\u5237\u65b0\u65f6\u7684\u52a8\u753b\u4fdd\u6301\u4e00\u81f4\uff0c\u5176\u5b9e\u5b9e\u73b0\u8d77\u6765\u5e76\u4e0d\u96be\uff0c\u63a5\u4e0b\u6765\u5c31\u770b\u770b\u5177\u4f53\u5b9e\u73b0:wxml: &lt;view class=&#8221;scroll&#8221; bindtouchstart=&#8221;touchStart&#8221; bindtouchmove=&#8221;touchMove&#8221; bindtouchend=&#8221;touchEnd&#8221;&gt; &lt;view class=&#8221;animation&#8221;&gt; &lt;view class=&#8221;loading&#8221;&gt;&lt;\/view&gt; &lt;text class=&#8221;tip&#8221;&gt;{{state === 0 ? &#8216;\u4e0b\u62c9\u5237\u65b0&#8217; : state === 1? &#8216;\u677e\u5f00\u5237\u65b0&#8217; : &#8216;\u5237\u65b0\u4e2d&#8217;}}&lt;\/text&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-33391","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=33391"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33391\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}