-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2093-4e7c462abc5aa45bd952.js
1 lines (1 loc) · 56.3 KB
/
2093-4e7c462abc5aa45bd952.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[2093],{62093:(n,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>f});var t=a(73450),p=a(27378),e=a(57318),o=a(77944),c=a(96681),l=a(24246);function u(n,s){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable}))),a.push.apply(a,t)}return a}function i(n){for(var s=1;s<arguments.length;s++){var a=null!=arguments[s]?arguments[s]:{};s%2?u(Object(a),!0).forEach((function(s){(0,t.Z)(n,s,a[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):u(Object(a)).forEach((function(s){Object.defineProperty(n,s,Object.getOwnPropertyDescriptor(a,s))}))}return n}var r=function(){var n=[1,2,3,4,5];class s extends p.Component{render(){return(0,l.jsxs)("div",{className:"swiper-demo-container",children:[(0,l.jsx)(o.t,{className:"swiper-demo-simple",children:n.map(((n,s)=>(0,l.jsx)("div",{className:"swiper-demo-simple-h",children:n},s)))}),(0,l.jsx)(o.t,{className:"swiper-demo-simple",dotsColor:"#31A896",dotsSize:"small",children:n.map(((n,s)=>(0,l.jsx)("div",{className:"swiper-demo-simple-h",children:n},s)))})]})}}return(0,l.jsx)(s,{})},k=function(){var n=[1,2,3,4,5];class s extends p.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{current:null,prev:null}),(0,t.Z)(this,"handleChange",((n,s)=>{this.setState({current:n,prev:s})}))}render(){var s=this.state,a=s.current,t=s.prev;return(0,l.jsxs)("div",{children:[(0,l.jsx)(o.t,{className:"swiper-demo-simple",dotsColor:"red",dotsSize:"small",arrows:!0,autoplay:!0,onChange:this.handleChange,children:n.map(((n,s)=>(0,l.jsx)("div",{className:"swiper-demo-simple-h",children:n},s)))}),"number"==typeof a&&"number"==typeof t&&(0,l.jsxs)("div",{className:"swiper-demo-simple-text",children:["从 ",t+1," 到 ",a+1]})]})}}return(0,l.jsx)(s,{})},d=function(){var n=[1,2,3,4,5];class s extends p.Component{constructor(...n){super(...n),(0,t.Z)(this,"go",(n=>{this.swiper.swipeTo(n)})),(0,t.Z)(this,"prev",(()=>{this.swiper.prev()})),(0,t.Z)(this,"next",(()=>{this.swiper.next()}))}render(){return(0,l.jsxs)("div",{className:"swiper-demo-container no-flex",children:[(0,l.jsx)(o.t,{ref:n=>this.swiper=n,className:"swiper-demo-simple",children:n.map(((n,s)=>(0,l.jsx)("div",{className:"swiper-demo-simple-h",children:n},s)))}),(0,l.jsxs)("div",{className:"swiper-demo-btn-group",children:[n.map(((n,s)=>(0,l.jsx)(c.z,{type:"primary",onClick:()=>this.go(s),children:n},s))),(0,l.jsx)(c.z,{type:"primary",outline:!0,onClick:()=>this.prev(),children:"prev"}),(0,l.jsx)(c.z,{type:"primary",outline:!0,onClick:()=>this.next(),children:"next"})]})]})}}return(0,l.jsx)(s,{})},m=function(){class n extends p.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{pages:[1,2,3,4,5]}),(0,t.Z)(this,"handleAddPage",(()=>{var n=this.state.pages,s=n[n.length-1];this.setState({pages:[...n,s+1]})})),(0,t.Z)(this,"handleRemovePage",(()=>{var n=this.state.pages,s=n.filter(((s,a)=>a!==n.length-1));this.setState({pages:s})}))}render(){var n=this.state.pages;return(0,l.jsxs)("div",{children:[(0,l.jsx)(o.t,{className:"swiper-demo-simple",dotsColor:"#fc0",dotsSize:"small",arrows:!0,autoplay:!0,children:n.map(((n,s)=>(0,l.jsx)("div",{className:"swiper-demo-simple-h",children:n},s)))}),(0,l.jsxs)("div",{style:{marginTop:"20px"},children:[(0,l.jsx)(c.z,{type:"primary",onClick:this.handleAddPage,children:"增加"}),(0,l.jsx)(c.z,{type:"primary",outline:!0,onClick:this.handleRemovePage,children:"移除"})]})]})}}return(0,l.jsx)(n,{})};function h(n){return(0,l.jsx)(n.tag,i(i({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function g(n){return(0,l.jsx)(h,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function w(n){return(0,l.jsx)(h,{tag:"style",html:n.style})}function v(n,s){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(s+=n.offsetTop),v(n.parentNode,s);return s}class y extends p.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{showCode:!1}),(0,t.Z)(this,"toggle",(()=>{this.setState({showCode:!this.state.showCode})}))}render(){var n=this.state.showCode,s=this.props,a=s.title,t=s.src,p=s.children;return(0,l.jsxs)("div",{className:"zandoc-react-demo",children:[(0,l.jsx)("div",{className:"zandoc-react-demo__preview",children:p}),(0,l.jsxs)("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle,children:[(0,l.jsx)("div",{className:"zandoc-react-demo__title",children:(0,l.jsx)("p",{children:a||""})}),(0,l.jsx)("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})]}),n&&(0,l.jsx)("pre",{className:"zandoc-react-demo__code",children:(0,l.jsx)(h,{tag:"code",html:t,attributes:{className:"language-jsx"}})})]})}}class f extends p.Component{componentDidMount(){var n=location.hash;if(n){var s=document.querySelector('a[href="'.concat(n,'"]'));s&&(0,e.l)(document.documentElement,0,v(s,-9))}}render(){return p.createElement("div",{className:"zandoc-react-container"},p.createElement(w,{style:".swiper-demo-container {\n\tdisplay: flex;\n}\n.swiper-demo-simple {\n\theight: 150px;\n\twidth: 300px;\n\tbackground: #FAFAFA;\n\tmargin-right: 10px;\n}\n.swiper-demo-simple-h {\n\ttext-align: center;\n\tfont-size: 18px;\n\tline-height: 150px;\n}\n.swiper-demo-simple-text {\n\tmargin-top: 10px;\n}\n.swiper-demo-btn-group {\n\tmargin-top: 20px;\n}\n.no-flex {\n\tdisplay: block !important;\n}"}),p.createElement(g,{html:'<h2 class="anchor-heading"><a href="#swiper-lun-bo">¶</a><a href="javascript:void(0)" id="swiper-lun-bo" class="anchor-point"></a>Swiper 轮播</h2>\n<p>Swiper 主要用于对一组平级内容进行轮播展示</p>\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>'}),p.createElement(y,{title:"基础用法",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Swiper</span> <span class="token punctuation">}</span></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">const</span> pages <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">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>swiper-demo-container<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">Swiper</span></span>\n <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>swiper-demo-simple<span class="token punctuation">"</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>\n pages<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</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>swiper-demo-simple-h<span class="token punctuation">"</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>index<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>item<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 punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Swiper</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">Swiper</span></span>\n <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>swiper-demo-simple<span class="token punctuation">"</span></span>\n <span class="token attr-name">dotsColor</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>#31A896<span class="token punctuation">"</span></span>\n <span class="token attr-name">dotsSize</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>small<span class="token punctuation">"</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>\n pages<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</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>swiper-demo-simple-h<span class="token punctuation">"</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>index<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>item<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 punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Swiper</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\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Simple</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},p.createElement(r)),p.createElement(y,{title:"带左右箭头, 自动切换",id:"Demoarrow",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Swiper</span> <span class="token punctuation">}</span></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">const</span> pages <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n current<span class="token operator">:</span> <span class="token keyword null nil">null</span><span class="token punctuation">,</span>\n prev<span class="token operator">:</span> <span class="token keyword null nil">null</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">handleChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">current<span class="token punctuation">,</span> prev</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> current<span class="token punctuation">,</span> prev <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> current<span class="token punctuation">,</span> prev <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">;</span>\n <span class="token keyword control-flow">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 punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Swiper</span></span>\n <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>swiper-demo-simple<span class="token punctuation">"</span></span>\n <span class="token attr-name">dotsColor</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>red<span class="token punctuation">"</span></span>\n <span class="token attr-name">dotsSize</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>small<span class="token punctuation">"</span></span>\n <span class="token attr-name">arrows</span>\n <span class="token attr-name">autoplay</span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">handleChange</span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>\n pages<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</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>swiper-demo-simple-h<span class="token punctuation">"</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>index<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>item<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 punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Swiper</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>\n <span class="token keyword">typeof</span> current <span class="token operator">===</span> <span class="token string">\'number\'</span> <span class="token operator">&&</span> <span class="token keyword">typeof</span> prev <span class="token operator">===</span> <span class="token string">\'number\'</span> <span class="token operator">&&</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>swiper-demo-simple-text<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>从 <span class="token punctuation">{</span>prev <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">}</span> 到 <span class="token punctuation">{</span>current <span class="token operator">+</span> <span class="token number">1</span><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>\n <span class="token punctuation">}</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<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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Simple</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},p.createElement(k)),p.createElement(y,{title:"外部方法控制轮播",id:"Demomethod",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Swiper</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></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">const</span> pages <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n\n <span class="token function-variable function">go</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">swiper</span><span class="token punctuation">.</span><span class="token method function property-access">swipeTo</span><span class="token punctuation">(</span>index<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">prev</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">swiper</span><span class="token punctuation">.</span><span class="token method function property-access">prev</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">next</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">swiper</span><span class="token punctuation">.</span><span class="token method function property-access">next</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">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>swiper-demo-container no-flex<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">Swiper</span></span>\n <span class="token attr-name">ref</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">(</span><span class="token parameter">swiper</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">swiper</span> <span class="token operator">=</span> swiper<span class="token punctuation">}</span></span>\n <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>swiper-demo-simple<span class="token punctuation">"</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>\n pages<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</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>swiper-demo-simple-h<span class="token punctuation">"</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>index<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>item<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 punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Swiper</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>swiper-demo-btn-group<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>\n pages<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</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">Button</span></span>\n <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>index<span class="token punctuation">}</span></span>\n <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span>\n <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</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 keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">go</span><span class="token punctuation">(</span>index<span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>item<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Button</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><span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Button</span></span>\n <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span>\n <span class="token attr-name">outline</span>\n <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</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 keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">prev</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n prev\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Button</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">Button</span></span>\n <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span>\n <span class="token attr-name">outline</span>\n <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</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 keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">next</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n next\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Button</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\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Simple</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},p.createElement(d)),p.createElement(y,{title:"动态增减子元素",id:"Demodynamicaddchild",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Swiper</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></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">class</span> <span class="token class-name">Simple</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n pages<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">handleAddPage</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> pages <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> lastItem <span class="token operator">=</span> pages<span class="token punctuation">[</span>pages<span class="token punctuation">.</span><span class="token property-access">length</span> <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span>lastItem<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n pages<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token spread operator">...</span>pages<span class="token punctuation">,</span> lastItem <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">handleRemovePage</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> pages <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> newPages <span class="token operator">=</span> pages<span class="token punctuation">.</span><span class="token method function property-access">filter</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> index <span class="token operator">!==</span> pages<span class="token punctuation">.</span><span class="token property-access">length</span> <span class="token operator">-</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n pages<span class="token operator">:</span> newPages\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> pages <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">;</span>\n <span class="token keyword control-flow">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 punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Swiper</span></span>\n <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>swiper-demo-simple<span class="token punctuation">"</span></span>\n <span class="token attr-name">dotsColor</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>#fc0<span class="token punctuation">"</span></span>\n <span class="token attr-name">dotsSize</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>small<span class="token punctuation">"</span></span>\n <span class="token attr-name">arrows</span>\n <span class="token attr-name">autoplay</span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>\n pages<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span> index</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</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>swiper-demo-simple-h<span class="token punctuation">"</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>index<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>item<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 punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Swiper</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">style</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> marginTop<span class="token operator">:</span> <span class="token string">\'20px\'</span> <span class="token punctuation">}</span><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">Button</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>primary<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">handleAddPage</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>增加<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Button</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">Button</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>primary<span class="token punctuation">"</span></span> <span class="token attr-name">outline</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">handleRemovePage</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>移除<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Button</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<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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Simple</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},p.createElement(m)),p.createElement(g,{html:'<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\n<p><strong><code>children</code> 中的元素必须支持透传 <code>style</code> 到原生节点上,否则样式会失效。</strong></p>\n<table class="table">\n<thead>\n<tr>\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>transitionDuration</td>\n<td>切换动画持续时间(ms)</td>\n<td>number</td>\n<td><code>300</code></td>\n<td></td>\n</tr>\n<tr>\n<td>autoplay</td>\n<td>是否自动切换</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>false</code>\n, \n<code>true</code></td>\n</tr>\n<tr>\n<td>autoplayInterval</td>\n<td>自动切换间隔时间(ms)</td>\n<td>number</td>\n<td><code>3000</code></td>\n<td></td>\n</tr>\n<tr>\n<td>dots</td>\n<td>是否显示下方翻页按钮</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>dotsColor</td>\n<td>下方翻页按钮颜色</td>\n<td>string</td>\n<td><code>\'black\'</code></td>\n<td><code>\'blue\'</code>\n, \n<code>\'red\'</code>\n, \n<code>\'green\'</code>\n, \n<code>自定义css颜色值</code></td>\n</tr>\n<tr>\n<td>dotsSize</td>\n<td>下方翻页按钮大小</td>\n<td>string</td>\n<td><code>\'normal\'</code></td>\n<td><code>\'small\'</code>\n, \n<code>\'large\'</code></td>\n</tr>\n<tr>\n<td>arrows</td>\n<td>是否显示两侧翻页按钮</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>arrowsType</td>\n<td>两侧箭头颜色</td>\n<td>string</td>\n<td><code>\'dark\'</code></td>\n<td><code>\'dark\'</code>\n, \n<code>\'light\'</code></td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>切换时回调函数</td>\n<td>(current: number, prev: number): void</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>renderPrevArrow</td>\n<td>自定义渲染切换上一个的按钮</td>\n<td><code>(onPrev: () => void) => ReactNode</code></td>\n<td>默认按钮</td>\n<td></td>\n</tr>\n<tr>\n<td>renderNextArrow</td>\n<td>自定义渲染切换下一个的按钮</td>\n<td><code>(onNext: () => void) => ReactNode</code></td>\n<td>默认按钮</td>\n<td></td>\n</tr>\n<tr>\n<td>className</td>\n<td>自定义额外类名</td>\n<td>string</td>\n<td><code>\'\'</code></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h3 class="anchor-heading"><a href="#shi-li-fang-fa">¶</a><a href="javascript:void(0)" id="shi-li-fang-fa" class="anchor-point"></a>实例方法</h3>\n<table class="table">\n<thead>\n<tr>\n<th>方法名</th>\n<th>说明</th>\n<th>参数名</th>\n<th>参数描述</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>swipeTo</td>\n<td>手动切换轮播图</td>\n<td>index</td>\n<td>需要切换的轮播图索引,从 0 开始</td>\n</tr>\n<tr>\n<td>prev</td>\n<td>切换至上一张轮播图</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>next</td>\n<td>切换至下一张轮播图</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>'}))}}},77944:(n,s,a)=>{"use strict";a.d(s,{t:()=>h});var t=a(59312),p=a(24246),e=a(27378),o=a(60042),c=a.n(o),l=a(14322),u=a(27036),i=["black","blue","red","green"],r=function(n){function s(){var s=null!==n&&n.apply(this,arguments)||this;return s.isDotActive=function(n,s,a){return n===s||0===n&&s>a-1||n===a-1&&s<0},s.isBuildInColor=function(n){return-1!==i.indexOf(n)},s}return(0,t.ZT)(s,n),s.prototype.render=function(){var n,s=this,a=this.props,o=a.dotsColor,l=a.dotsSize,u=a.items,i=a.currentIndex,r=a.onDotsClick,k=c()("zent-swiper__dots","zent-swiper__dots-"+l,((n={})["zent-swiper__dots-"+o]=this.isBuildInColor(o),n));return(0,p.jsx)("ul",(0,t.pi)({className:k,"data-zv":"9.12.16"},{children:e.Children.map(u,(function(n,a){var t=s.isDotActive(a,i,u.length);return t&&!s.isBuildInColor(o)?(0,p.jsx)("li",{style:{background:o},className:"zent-swiper__dots-item zent-swiper__dots-item-active","data-zv":"9.12.16"},a):(0,p.jsx)("li",{className:c()("zent-swiper__dots-item",{"zent-swiper__dots-item-active":t}),onClick:function(){return r(a)},"data-zv":"9.12.16"},a)}))}),void 0)},s}(e.PureComponent);function k(n,s){var a=n.style;Object.keys(s).forEach((function(n){a[n]=s[n]}))}var d=function(n){return(0,p.jsx)("div",(0,t.pi)({className:"zent-swiper__arrow zent-swiper__arrow-left",onClick:n,"data-zv":"9.12.16"},{children:(0,p.jsx)(u.Z,{type:"right-circle",className:"zent-swiper__arrow-icon"},void 0)}),void 0)},m=function(n){return(0,p.jsx)("div",(0,t.pi)({className:"zent-swiper__arrow zent-swiper__arrow-right",onClick:n,"data-zv":"9.12.16"},{children:(0,p.jsx)(u.Z,{type:"right-circle",className:"zent-swiper__arrow-icon"},void 0)}),void 0)},h=function(n){function s(){var s=null!==n&&n.apply(this,arguments)||this;return s.state={currentIndex:0},s.init=function(n){void 0===n&&(n=!1);var a=s.props,t=a.autoplay,p=a.children,o=s.state.currentIndex,c=e.Children.count(p),l=s.swiperContainer.children;s.clearAutoplay(),s.setSwiperWidth(),k(s.swiperContainer,{width:s.swiperWidth*l.length+"px"});for(var u=0;u<l.length;u++)k(l[u],{width:100/l.length+"%"});n&&s.translate(-1,null,!0),c>1&&(t&&s.startAutoplay(),s.translate(o,null,!0))},s.getSwiper=function(n){s.swiper=n},s.getSwiperContainer=function(n){s.swiperContainer=n},s.setSwiperWidth=function(){s.swiperWidth=s.swiper.getBoundingClientRect().width},s.startAutoplay=function(){var n=s.props.autoplayInterval;s.autoplayTimer=setTimeout(s.next,Number(n))},s.clearAutoplay=function(){clearTimeout(s.autoplayTimer),s.autoplayTimer=void 0},s.next=function(){var n=s.state.currentIndex;1!==e.Children.count(s.props.children)&&s.swipeTo(n+1)},s.prev=function(){var n=s.state.currentIndex;s.swipeTo(n-1)},s.swipeTo=function(n){n===s.state.currentIndex||s.isSwiping||(s.isSwiping=!0,s.setState({currentIndex:n}))},s.translate=function(n,a,t){var p=s.props,e=p.autoplay,o=p.autoplayInterval,c=p.transitionDuration,l=p.onChange,u=s.props.children.length,i=s.swiperWidth*(-1-n),r=t?0:c;if(e&&!s.isMouseEnter&&(clearTimeout(s.autoplayTimer),s.autoplayTimer=setTimeout(s.next,Number(o))),k(s.swiperContainer,{transform:"translateX("+i+"px)","transition-duration":r+"ms"}),n>u-1||n<0)return s.resetPosition(n);setTimeout((function(){s.isSwiping=!1}),r),l&&l(n,s.getRealPrevIndex(a))},s.resetPosition=function(n){var a=s.props.transitionDuration,t=s.props.children.length;n<0?setTimeout((function(){return s.setState({currentIndex:t-1})}),a):setTimeout((function(){return s.setState({currentIndex:0})}),a)},s.getRealPrevIndex=function(n){var a=s.props.children.length;return null===n?null:n>a-1?a-1:n<0?0:n},s.cloneChildren=function(n){var s=e.Children.count(n);if(s<=1)return n;var a=new Array(s+2);return e.Children.forEach(n,(function(n,t){a[t+1]=n,0===t?a[s+1]=n:t===s-1&&(a[0]=n)})),a},s.handleMouseEnter=function(){var n=s.props.autoplay;s.isMouseEnter=!0,n&&s.clearAutoplay()},s.handleMouseLeave=function(){var n=s.props.autoplay;s.isMouseEnter=!1,n&&s.startAutoplay()},s.handleDotsClick=function(n){s.setState({currentIndex:n})},s.handleResize=function(){return s.init()},s}return(0,t.ZT)(s,n),s.getDerivedStateFromProps=function(n,s){if(!s.prevProps)return{prevProps:n};var a=n.children,t=s.prevProps.children;return e.Children.count(t)!==e.Children.count(a)?{currentIndex:0,prevProps:n}:null},s.prototype.componentDidMount=function(){this.init()},s.prototype.componentDidUpdate=function(n,s){var a=this.props.children.length,t=this.state.currentIndex,p=s.currentIndex,o=p>a-1||p<0;if(p!==t&&this.translate(t,p,o),e.Children.count(n.children)!==e.Children.count(this.props.children)){var c=2===e.Children.count(n.children)&&1===e.Children.count(this.props.children);this.init(c)}},s.prototype.componentWillUnmount=function(){this.clearAutoplay()},s.prototype.render=function(){var n=this.props,s=n.className,a=n.dots,o=n.dotsColor,u=n.dotsSize,i=n.arrows,k=n.arrowsType,d=n.children,m=n.renderNextArrow,h=n.renderPrevArrow,g=this.state.currentIndex,w=c()("zent-swiper",s,{"zent-swiper-light":i&&"light"===k}),v=e.Children.count(d),y=this.cloneChildren(d);return(0,p.jsxs)("div",(0,t.pi)({ref:this.getSwiper,className:w,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,"data-zv":"9.12.16"},{children:[i&&v>1&&h(this.prev),i&&v>1&&m(this.next),(0,p.jsx)("div",(0,t.pi)({ref:this.getSwiperContainer,className:"zent-swiper__container","data-zv":"9.12.16"},{children:e.Children.map(y,(function(n,s){return(0,e.cloneElement)(n,{key:s-1,style:{float:"left",height:"100%"}})}))}),void 0),a&&v>1&&(0,p.jsx)(r,{dotsColor:o,dotsSize:u,items:d,currentIndex:g,onDotsClick:this.handleDotsClick},void 0),(0,p.jsx)(l.w,{onResize:this.handleResize},void 0)]}),void 0)},s.defaultProps={className:"",transitionDuration:300,autoplay:!1,autoplayInterval:3e3,dots:!0,dotsColor:"black",dotsSize:"normal",arrows:!1,arrowsType:"dark",renderPrevArrow:d,renderNextArrow:m},s}(e.Component)},14322:(n,s,a)=>{"use strict";a.d(s,{w:()=>u});var t=a(24246),p=a(27378),e=a(27468),o=a(80186),c=a(17127),l={passive:!0},u=function(n){var s=n.disableThrottle,a=void 0!==s&&s,u=n.onResize,i=(0,p.useRef)(null),r=(0,p.useRef)(u);r.current=u;var k=(0,p.useCallback)((function(n){var s=(0,e.ZP)();i.current||(i.current=s);var a=i.current,t={deltaX:s.width-a.width,deltaY:s.height-a.height};0===t.deltaX&&0===t.deltaY||(r.current(n,t),i.current=s)}),[]),d=(0,c.BN)(k,a);return(0,p.useEffect)((function(){return i.current=(0,e.ZP)(),d.cancel}),[d]),(0,t.jsx)(o.ZP,{eventName:"resize",listener:d,options:l},void 0)}}}]);