{"id":185428,"date":"2023-08-26T21:39:44","date_gmt":"2023-08-26T13:39:44","guid":{"rendered":"http:\/\/www.idc.net\/help\/185428\/"},"modified":"2023-08-26T21:39:44","modified_gmt":"2023-08-26T13:39:44","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%95%99%e7%a8%8b%ef%bc%9a%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f-%e6%89%a9%e5%b1%95%e7%bb%84%e4%bb%b6%c2%b7%e7%b2%98%e6%80%a7%e5%b8%83","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/185428\/","title":{"rendered":"\u540e\u6d6a\u4e91\u5c0f\u7a0b\u5e8f\u6559\u7a0b\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u6269\u5c55\u7ec4\u4ef6\u00b7\u7c98\u6027\u5e03\u5c40\u7ec4\u4ef6"},"content":{"rendered":"<h2>sticky<\/h2>\n<p>\u7c98\u6027\u5e03\u5c40\u7ec4\u4ef6\u3002Sticky \u7ec4\u4ef6\u4e0e CSS \u4e2d&nbsp;position: sticky&nbsp;\u5c5e\u6027\u5b9e\u73b0\u7684\u6548\u679c\u4e00\u81f4\uff0c\u5f53\u7ec4\u4ef6\u5728\u5c4f\u5e55\u8303\u56f4\u5185\u65f6\uff0c\u4f1a\u6309\u7167\u6b63\u5e38\u7684\u5e03\u5c40\u6392\u5217\uff0c\u5f53\u7ec4\u4ef6\u6eda\u51fa\u5c4f\u5e55\u8303\u56f4\u65f6\uff0c\u59cb\u7ec8\u4f1a\u56fa\u5b9a\u5728\u5c4f\u5e55\u9876\u90e8\u3002<\/p>\n<h2>\u5c5e\u6027\u5217\u8868<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u5fc5\u586b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>offset-top<\/td>\n<td>Number<\/td>\n<td>0<\/td>\n<td>\u5426<\/td>\n<td>\u5438\u9876\u65f6\u4e0e\u9876\u90e8\u7684\u8ddd\u79bb\uff0c\u5355\u4f4dpx<\/td>\n<\/tr>\n<tr>\n<td>z-index<\/td>\n<td>Number<\/td>\n<td>99<\/td>\n<td>\u5426<\/td>\n<td>\u5438\u9876\u65f6\u7684 z-index<\/td>\n<\/tr>\n<tr>\n<td>container<\/td>\n<td>function<\/td>\n<td>null<\/td>\n<td>\u5426<\/td>\n<td>\u4e00\u4e2a\u51fd\u6570\uff0c\u8fd4\u56de\u5bb9\u5668\u5bf9\u5e94\u7684 NodesRef \u8282\u70b9<\/td>\n<\/tr>\n<tr>\n<td>disabled<\/td>\n<td>Boolean<\/td>\n<td>false<\/td>\n<td>\u5426<\/td>\n<td>\u662f\u5426\u7981\u7528<\/td>\n<\/tr>\n<tr>\n<td>bindscroll<\/td>\n<td>eventhandle<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u6eda\u52a8\u65f6\u89e6\u53d1\uff0c{scrollTop: \u8ddd\u79bb\u9876\u90e8\u4f4d\u7f6e, isFixed: \u662f\u5426\u5438\u9876 }<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4ee3\u7801\u6f14\u793a<\/h3>\n<h4>\u5438\u9876\u8ddd\u79bb<\/h4>\n<p>\u901a\u8fc7&nbsp;offset-top&nbsp;\u5c5e\u6027\u53ef\u4ee5\u8bbe\u7f6e\u7ec4\u4ef6\u5728\u5438\u9876\u65f6\u4e0e\u9876\u90e8\u7684\u8ddd\u79bb<\/p>\n<pre><code>&lt;mp-sticky offset-top=\"32\"&gt;\n  &lt;button size=\"mini\" type=\"primary\" style=\"margin-left: 115px; background-color: #1989fa\"&gt;\u5438\u9876\u8ddd\u79bb&lt;\/button&gt;\n&lt;\/mp-sticky&gt;\n<\/code><\/pre>\n<h4>\u6307\u5b9a\u5bb9\u5668<\/h4>\n<p>\u901a\u8fc7&nbsp;container&nbsp;\u5c5e\u6027\u53ef\u4ee5\u6307\u5b9a\u7ec4\u4ef6\u7684\u5bb9\u5668\uff0c\u9875\u9762\u6eda\u52a8\u65f6\uff0c\u7ec4\u4ef6\u4f1a\u59cb\u7ec8\u4fdd\u6301\u5728\u5bb9\u5668\u8303\u56f4\u5185\uff0c\u5f53\u7ec4\u4ef6\u5373\u5c06\u8d85\u51fa\u5bb9\u5668\u5e95\u90e8\u65f6\uff0c\u4f1a\u8fd4\u56de\u539f\u4f4d\u7f6e\u3002<\/p>\n<pre><code>&lt;view id=\"container\" style=\"height: 250px; background-color: #E0E0E0;\"&gt;\n  &lt;view style=\"height: 100px; background-color: #FFFF99;\"&gt;&lt;\/view&gt;\n  &lt;mp-sticky container=\"{{container}}\" offset-top=\"64\"&gt;\n    &lt;button size=\"mini\" type=\"primary\" style=\"margin-left: 215px; background-color: #ff976a\"&gt;\u6307\u5b9a\u5bb9\u5668&lt;\/button&gt;\n  &lt;\/mp-sticky&gt;\n&lt;\/view&gt;\n<\/code><\/pre>\n<pre><code>Page({\n  data: {\n    container: null\n  },\n\n  onReady() {\n    this.setData({\n      container: () =&gt; wx.createSelectorQuery().select('#container')\n    })\n  }\n})<\/code><\/pre>\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>sticky \u7c98\u6027\u5e03\u5c40\u7ec4\u4ef6\u3002Sticky \u7ec4\u4ef6\u4e0e CSS \u4e2d&nbsp;position: sticky&#038;nb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182398],"tags":[],"class_list":["post-185428","post","type-post","status-publish","format-standard","hentry","category-mini-program"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=185428"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185428\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=185428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=185428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=185428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}