-
Notifications
You must be signed in to change notification settings - Fork 0
/
149-9c128e7e1f8e9241073d.js
1 lines (1 loc) · 31.9 KB
/
149-9c128e7e1f8e9241073d.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[149],{891:function(n,a,s){"use strict";s.r(a),s.d(a,"default",(function(){return W}));var t=s(840),p=s.n(t),e=s(841),o=s.n(e),c=s(521),l=s.n(c),u=s(842),i=s.n(u),k=s(843),r=s.n(k),d=s(844),m=s.n(d),g=s(845),y=s.n(g),f=s(846),v=s.n(f),h=s(848),w=s.n(h),b=s(0),E=s.n(b),_=s(210),S=s(145),N=s(152);function x(n){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}();return function(){var s,t=m()(n);if(a){var p=m()(this).constructor;s=Reflect.construct(t,arguments,p)}else s=t.apply(this,arguments);return r()(this,s)}}var C=function(){function n(n){var s=E.a.useState(null),t=w()(s,2),p=t[0],e=t[1],o=E.a.useCallback((function(){return e("Waypoint 进入屏幕")}),[]),c=E.a.useCallback((function(){return e("Waypoint 离开屏幕")}),[]);return E.a.createElement("div",{className:"waypoint-demo-basic"},p?E.a.createElement("div",{className:"waypoint-demo-basic__message"},p):null,E.a.createElement("div",{className:"waypoint-demo-basic__scrollable-parent"},E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement("div",{className:"waypoint-demo-basic__waypoint-line"}),E.a.createElement(S.Waypoint,{onEnter:o,onLeave:c}),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null),E.a.createElement(a,null)))}function a(){return E.a.createElement("div",{className:"waypoint-demo-basic__spacer"},E.a.createElement(S.Icon,{type:"down"}))}return E.a.createElement(n,null)},R=function(){function n(n){var a=E.a.useState(!1),s=w()(a,2),t=s[0],p=s[1],e=E.a.useCallback((function(){return p(!0)}),[]),o=E.a.useCallback((function(){return p(!1)}),[]);return E.a.createElement(E.a.Fragment,null,E.a.createElement(S.Waypoint,{onEnter:e,onLeave:o}),E.a.createElement(N.CSSTransition,{in:t,timeout:500,classNames:"waypoint-demo-reveal",unmountOnExit:!0},n.children))}function a(a){return E.a.createElement("div",{className:"waypoint-demo-reveal"},E.a.createElement("div",{className:"waypoint-demo-reveal__scrollable-parent"},E.a.createElement(s,null),E.a.createElement(s,null),E.a.createElement(s,null),E.a.createElement(n,null,E.a.createElement("p",{className:"waypoint-demo-reveal-text"},"Surely You're Joking, Mr. Feynman!")),E.a.createElement(s,null),E.a.createElement(s,null),E.a.createElement(s,null)))}function s(){return E.a.createElement("div",{className:"waypoint-demo-reveal__spacer"},E.a.createElement(S.Icon,{type:"down",className:"waypoint-demo-reveal-pulse"}))}return E.a.createElement(a,null)};function z(n){return E.a.createElement(n.tag,v()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function O(n){return E.a.createElement(z,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function D(n){return E.a.createElement(z,{tag:"style",html:n.style})}var M=function(n){i()(s,n);var a=x(s);function s(){var n;p()(this,s);for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return n=a.call.apply(a,[this].concat(e)),y()(l()(n),"state",{showCode:!1}),y()(l()(n),"toggle",(function(){n.setState({showCode:!n.state.showCode})})),n}return o()(s,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,p=a.children;return E.a.createElement("div",{className:"zandoc-react-demo"},E.a.createElement("div",{className:"zandoc-react-demo__preview"},p),E.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},E.a.createElement("div",{className:"zandoc-react-demo__title"},E.a.createElement("p",null,s||"")),E.a.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&E.a.createElement("pre",{className:"zandoc-react-demo__code"},E.a.createElement(z,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),s}(b.Component),W=function(n){i()(s,n);var a=x(s);function s(){return p()(this,s),a.apply(this,arguments)}return o()(s,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&Object(_.a)(document.documentElement,0,function n(a,s){for(;a;)return a.offsetTop&&"static"!==getComputedStyle(a).position&&(s+=a.offsetTop),n(a.parentNode,s);return s}(a,-9))}}},{key:"render",value:function(){return E.a.createElement("div",{className:"zandoc-react-container",key:null},E.a.createElement(D,{style:".waypoint-demo-basic {\n position: relative;\n}\n\n.waypoint-demo-basic__scrollable-parent {\n max-height: 400px;\n overflow: scroll;\n position: relative;\n}\n\n.waypoint-demo-basic__spacer {\n color: #969799;\n font-size: 40px;\n line-height: 200px;\n text-align: center;\n}\n\n.waypoint-demo-basic__waypoint-line {\n border-top: 2px dashed #d40000;\n}\n\n.waypoint-demo-basic__message {\n\tbox-sizing: border-box;\n background-color: #f2f3f5;\n color: #323233;\n left: 0;\n opacity: 0.8;\n padding: 10px 0;\n pointer-events: none;\n position: absolute;\n text-align: center;\n top: 0;\n width: 100%;\n}\n\n.waypoint-demo-reveal {\n position: relative;\n}\n\n.waypoint-demo-reveal__scrollable-parent {\n max-height: 400px;\n overflow: scroll;\n position: relative;\n}\n\n.waypoint-demo-reveal__spacer {\n color: #969799;\n font-size: 40px;\n line-height: 200px;\n text-align: center;\n}\n\n.waypoint-demo-reveal-text {\n\ttransition: opacity 500ms, transform 500ms;\n\ttext-align: center;\n\tpadding: 10px 0;\n}\n\n.waypoint-demo-reveal-enter {\n\topacity: 0;\n\ttransform: scale(0.1);\n}\n\n.waypoint-demo-reveal-enter-active {\n\topacity: 1;\n\ttransform: scale(1);\n}\n\n.waypoint-demo-reveal-exit {\n\topacity: 1;\n\ttransform: scale(0.9);\n}\n\n.waypoint-demo-reveal-exit-active {\n\topacity: 0;\n\ttransform: scale(0);\n}"}),E.a.createElement(O,{html:'<h2 class="anchor-heading"><a href="#waypoint">¶</a><a href="javascript:void(0)" id="waypoint" class="anchor-point"></a>Waypoint</h2>\n<p>当滚动到某个 DOM 元素时执行一个函数,支持任意可滚动的容器。</p>\n<p><strong>常见使用场景:</strong></p>\n<ul>\n<li>懒加载图片</li>\n<li>无限滚动</li>\n<li>固钉</li>\n</ul>\n<h3 class="anchor-heading"><a href="#dai-ma-yan-shi">¶</a><a href="javascript:void(0)" id="dai-ma-yan-shi" class="anchor-point"></a>代码演示</h3>'}),E.a.createElement(M,{title:"基础用法",id:"Demo01basic",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Waypoint</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Demo</span></span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">[</span>msg<span class="token punctuation">,</span> setMsg<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useState</span><span class="token punctuation">(</span><span class="token keyword null nil">null</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> setEnterMsg <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setMsg</span><span class="token punctuation">(</span><span class="token string">\'Waypoint 进入屏幕\'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> setLeaveMsg <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setMsg</span><span class="token punctuation">(</span><span class="token string">\'Waypoint 离开屏幕\'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>msg <span class="token operator">?</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic__message<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>msg<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span> <span class="token operator">:</span> <span class="token keyword null nil">null</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic__scrollable-parent<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic__waypoint-line<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Waypoint</span></span> <span class="token attr-name">onEnter</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>setEnterMsg<span class="token punctuation">}</span></span> <span class="token attr-name">onLeave</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>setLeaveMsg<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Spacer</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-basic__spacer<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Icon</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>down<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Demo</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},E.a.createElement(C)),E.a.createElement(M,{title:"Reveal",id:"Demo02reveal",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Waypoint</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">CSSTransition</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'react-transition-group\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Reveal</span></span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">[</span>revealed<span class="token punctuation">,</span> setRevealed<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useState</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> reveal <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setRevealed</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> hide <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useCallback</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setRevealed</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Waypoint</span></span> <span class="token attr-name">onEnter</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>reveal<span class="token punctuation">}</span></span> <span class="token attr-name">onLeave</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>hide<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">CSSTransition</span></span>\n <span class="token attr-name">in</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>revealed<span class="token punctuation">}</span></span>\n <span class="token attr-name">timeout</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">500</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">classNames</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal<span class="token punctuation">"</span></span>\n <span class="token attr-name">unmountOnExit</span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>props<span class="token punctuation">.</span><span class="token property-access">children</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">CSSTransition</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Demo</span></span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal__scrollable-parent<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Reveal</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal-text<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token maybe-class-name">Surely</span> <span class="token maybe-class-name">You</span>\'re <span class="token maybe-class-name">Joking</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Mr</span><span class="token punctuation">.</span> <span class="token property-access"><span class="token maybe-class-name">Feynman</span></span><span class="token operator">!</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Reveal</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Spacer</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">Spacer</span></span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal__spacer<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Icon</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>down<span class="token punctuation">"</span></span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>waypoint-demo-reveal-pulse<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Demo</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},E.a.createElement(R)),E.a.createElement(O,{html:'<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>是否必须</th>\n<th>默认值</th>\n<th>备选值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>onEnter</td>\n<td>元素滚动到屏幕内时的回调函数</td>\n<td><code>(data: IWaypointCallbackData) => void</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onLeave</td>\n<td>元素滚动到屏幕外时的回调函数</td>\n<td><code>(data: IWaypointCallbackData) => void</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onPositionChange</td>\n<td>元素位置变化时的回调函数</td>\n<td><code>(data: IWaypointCallbackData) => void</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>topOffset</td>\n<td>距离容器顶部的距离</td>\n<td><code>number</code>\n \n|\n \n<code>string</code></td>\n<td>否</td>\n<td><code>0px</code></td>\n<td></td>\n</tr>\n<tr>\n<td>bottomOffset</td>\n<td>距离容器底部的距离</td>\n<td><code>number</code>\n \n|\n \n<code>string</code></td>\n<td>否</td>\n<td><code>0px</code></td>\n<td></td>\n</tr>\n<tr>\n<td>horizontal</td>\n<td>是否使用水平滚动模式</td>\n<td><code>boolean</code></td>\n<td>否</td>\n<td><code>false</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>scrollableAncestor</td>\n<td>指定滚动容器的 DOM 元素,一般当外层有多个滚动容器时才需要使用</td>\n<td><code>Element</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>fireOnRapidScroll</td>\n<td>当快速滚动时是否触发 \n<code>onEnter</code>\n 和 \n<code>onLeave</code></td>\n<td><code>boolean</code></td>\n<td>否</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>children</td>\n<td>待追踪的元素,不传时可以认为是追踪屏幕内一条线</td>\n<td><code>ReactNode</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p><strong>几点说明</strong></p>\n<ul>\n<li><a href="../../apidoc/interfaces/iwaypointcallbackdata.html"><code>IWaypointCallbackData</code> 的定义</a></li>\n<li>快速滚动顾名思义就是滚动速度非常快,元素可能进入屏幕后立刻又出了屏幕</li>\n<li><code>topOffset</code> 和 <code>bottomOffset</code> 可正可负,正负数效果和 <code>margin</code> 一样,正数往屏幕内偏移,负数往屏幕外偏移</li>\n<li><code>topOffset</code> 和 <code>bottomOffset</code> 可以是一个百分比,这个百分比是相对滚动容器大小的</li>\n<li>开启 <code>horizontal</code> 后,<code>topOffset</code> 其实是 <code>leftOffset</code>,而 <code>bottomOffset</code> 其实是 <code>rightOffset</code>,参数名特意没有变</li>\n<li><code>children</code> 只能是<strong>一个</strong>元素,这个元素必须是原生组件、<code>React.forwardRef</code> 包装过的自定义组件,或者是接受一个 <code>innerRef</code> 参数的自定义组件,其中自定义组件必须把 <code>ref</code> 设置到需要跟踪位置的 DOM 元素上</li>\n</ul>'}))}}]),s}(b.Component)}}]);