-
Notifications
You must be signed in to change notification settings - Fork 0
/
43-9c128e7e1f8e9241073d.js
1 lines (1 loc) · 86 KB
/
43-9c128e7e1f8e9241073d.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[43],{904:function(n,s,a){"use strict";a.r(s),a.d(s,"default",(function(){return J}));var t=a(846),p=a.n(t),o=a(840),e=a.n(o),c=a(841),l=a.n(c),u=a(521),i=a.n(u),k=a(842),r=a.n(k),d=a(843),m=a.n(d),g=a(844),h=a.n(g),y=a(845),f=a.n(y),v=a(0),w=a.n(v),C=a(210),b=a(145);function N(n){var s=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 a,t=h()(n);if(s){var p=h()(this).constructor;a=Reflect.construct(t,arguments,p)}else a=t.apply(this,arguments);return m()(this,a)}}var S=function(){var n=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{value:["330000","330100","330106"],options:[{id:"330000",title:"浙江省",children:[{id:"330100",title:"杭州市",children:[{id:"330106",title:"西湖区"}]},{id:"330200",title:"温州市",children:[{id:"330206",title:"龙湾区"}]}]},{id:"120000",title:"新疆维吾尔自治区",children:[{id:"120100",title:"博尔塔拉蒙古自治州",children:[{id:"120111",title:"阿拉山口市"}]}]}]}),f()(i()(n),"onChange",(function(s){b.Notify.success(JSON.stringify(s)),n.setState({value:s.map((function(n){return n.id}))})})),n}return l()(a,[{key:"render",value:function(){return w.a.createElement(b.Cascader,{value:this.state.value,options:this.state.options,onChange:this.onChange,title:["省","市","区"]})}}]),a}(w.a.Component);return w.a.createElement(n,null)},E=function(){var n=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{value:["330000","330100","330106"],options:[{id:"330000",title:"浙江省",children:[{id:"330100",title:"杭州市",children:[{id:"330106",title:"西湖区"}]},{id:"330200",title:"温州市",children:[{id:"330206",title:"龙湾区"}]}]},{id:"120000",title:"新疆维吾尔自治区",children:[{id:"120100",title:"博尔塔拉蒙古自治州",children:[{id:"120111",title:"阿拉山口市"}]}]}]}),f()(i()(n),"onChange",(function(s){b.Notify.success(JSON.stringify(s)),n.setState({value:s.map((function(n){return n.id}))})})),n}return l()(a,[{key:"render",value:function(){return w.a.createElement(b.Cascader,{value:this.state.value,options:this.state.options,onChange:this.onChange,type:"menu",title:["省","市","区"]})}}]),a}(w.a.Component);return w.a.createElement(n,null)},j=function(){var n=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{value:["330000","330100","330106"],options:[{id:"330000",title:"浙江省",children:[{id:"330100",title:"杭州市",children:[{id:"330106",title:"西湖区"}]}]},{id:"120000",title:"新疆维吾尔自治区",children:[{id:"120100",title:"博尔塔拉蒙古自治州",children:[{id:"120111",title:"阿拉山口市"}]}]}]}),f()(i()(n),"onChange",(function(s){n.setState({value:s.map((function(n){return n.id}))}),b.Notify.success(JSON.stringify(s))})),n}return l()(a,[{key:"render",value:function(){return w.a.createElement("div",null,w.a.createElement(b.Cascader,{value:this.state.value,options:this.state.options,onChange:this.onChange,changeOnSelect:!0,title:["省","市","区"]}),w.a.createElement("br",null),w.a.createElement("br",null),w.a.createElement(b.Cascader,{value:this.state.value,displayText:function(n){return n&&n.length>0?n[n.length-1].title:""},options:this.state.options,onChange:this.onChange,changeOnSelect:!0,title:["省","市","区"]}))}}]),a}(w.a.Component);return w.a.createElement(n,null)},O=function(){var n=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{value:[],options:[{id:"330000",title:"浙江省",isLeaf:!1},{id:"120000",title:"新疆维吾尔自治区",isLeaf:!1}]}),f()(i()(n),"loadMore",(function(n,s){return new Promise((function(n,a){setTimeout((function(){var a=s>=2,t=[{id:"66666".concat(s),title:"Label".concat(s),isLeaf:a}];n(t)}),500)}))})),f()(i()(n),"onChange",(function(s){b.Notify.success(JSON.stringify(s)),n.setState({value:s.map((function(n){return n.id}))})})),n}return l()(a,[{key:"render",value:function(){return w.a.createElement(b.Cascader,{value:this.state.value,options:this.state.options,onChange:this.onChange,loadMore:this.loadMore,placeholder:"请选择",type:"tabs",title:["省","市","区"]})}}]),a}(w.a.Component);return w.a.createElement(n,null)},M=function(){var n=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{value:[],options:[{id:"330000",title:"浙江省",isLeaf:!1},{id:"120000",title:"新疆维吾尔自治区",isLeaf:!1}]}),f()(i()(n),"loadMore",(function(n,s){return new Promise((function(n,a){setTimeout((function(){var a=s>=2,t=[{id:"66666".concat(s),title:"Label".concat(s),isLeaf:a}];n(t)}),500)}))})),f()(i()(n),"onChange",(function(s){b.Notify.success(JSON.stringify(s)),n.setState({value:s.map((function(n){return n.id}))})})),n}return l()(a,[{key:"render",value:function(){return w.a.createElement(b.Cascader,{value:this.state.value,options:this.state.options,onChange:this.onChange,loadMore:this.loadMore,placeholder:"请选择",type:"menu",title:["省","市","区"]})}}]),a}(w.a.Component);return w.a.createElement(n,null)},z=function(){var n=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{value:["330000","330100","330106"],options:[{id:"330000",title:"浙江省",children:[{id:"330100",title:"杭州市",children:[{id:"330106",title:"西湖区"}]},{id:"330200",title:"温州市",children:[{id:"330206",title:"龙湾区"}]}]},{id:"120000",title:"新疆维吾尔自治区",children:[{id:"120100",title:"博尔塔拉蒙古自治州",children:[{id:"120111",title:"阿拉山口市"}]}]}]}),f()(i()(n),"onChange",(function(s){b.Notify.success(JSON.stringify(s)),n.setState({value:s.map((function(n){return n.id}))})})),n}return l()(a,[{key:"render",value:function(){return w.a.createElement(b.Cascader,{value:this.state.value,options:this.state.options,onChange:this.onChange,type:"menu",expandTrigger:"hover",title:["省","市","区"]})}}]),a}(w.a.Component);return w.a.createElement(n,null)},L=function(){var n=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{value:["330000","330100","330106"],options:[{id:"330000",title:"浙江省",children:[{id:"330100",title:"杭州市",children:[{id:"330106",title:"西湖区"}]},{id:"330200",title:"温州市",children:[{id:"330206",title:"龙湾区"}]}]},{id:"120000",title:"新疆维吾尔自治区",children:[{id:"120100",title:"博尔塔拉蒙古自治州",children:[{id:"120111",title:"阿拉山口市"}]}]}]}),f()(i()(n),"onChange",(function(s){b.Notify.success(JSON.stringify(s)),n.setState({value:s.map((function(n){return n.id}))})})),n}return l()(a,[{key:"render",value:function(){return w.a.createElement(b.Cascader,{value:this.state.value,options:this.state.options,onChange:this.onChange,title:["省","市","区"],disabled:!0})}}]),a}(w.a.Component);return w.a.createElement(n,null)};function x(n){return w.a.createElement(n.tag,p()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function R(n){return w.a.createElement(x,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function _(n){return w.a.createElement(x,{tag:"style",html:n.style})}var D=function(n){r()(a,n);var s=N(a);function a(){var n;e()(this,a);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),f()(i()(n),"state",{showCode:!1}),f()(i()(n),"toggle",(function(){n.setState({showCode:!n.state.showCode})})),n}return l()(a,[{key:"render",value:function(){var n=this.state.showCode,s=this.props,a=s.title,t=s.src,p=s.children;return w.a.createElement("div",{className:"zandoc-react-demo"},w.a.createElement("div",{className:"zandoc-react-demo__preview"},p),w.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},w.a.createElement("div",{className:"zandoc-react-demo__title"},w.a.createElement("p",null,a||"")),w.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&&w.a.createElement("pre",{className:"zandoc-react-demo__code"},w.a.createElement(x,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),a}(v.Component),J=function(n){r()(a,n);var s=N(a);function a(){return e()(this,a),s.apply(this,arguments)}return l()(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var s=document.querySelector('a[href="'.concat(n,'"]'));s&&Object(C.a)(document.documentElement,0,function n(s,a){for(;s;)return s.offsetTop&&"static"!==getComputedStyle(s).position&&(a+=s.offsetTop),n(s.parentNode,a);return a}(s,-9))}}},{key:"render",value:function(){return w.a.createElement("div",{className:"zandoc-react-container",key:null},w.a.createElement(_,{style:""}),w.a.createElement(R,{html:'<h2 class="anchor-heading"><a href="#cascader-ji-lian-xuan-ze">¶</a><a href="javascript:void(0)" id="cascader-ji-lian-xuan-ze" class="anchor-point"></a>Cascader 级联选择</h2>\n<p>适用于各类级联操作(例如城市级联)</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>'}),w.a.createElement(D,{title:"基础用法",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Cascader</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</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">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 value<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">\'330000\'</span><span class="token punctuation">,</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span> <span class="token string">\'330106\'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n options<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'浙江省\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330106\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'西湖区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330200\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'温州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330206\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'龙湾区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'新疆维吾尔自治区\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'博尔塔拉蒙古自治州\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120111\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'阿拉山口市\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">success</span><span class="token punctuation">(</span><span class="token known-class-name class-name">JSON</span><span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\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 value<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token arrow operator">=></span> item<span class="token punctuation">.</span><span class="token property-access">id</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">render</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 class="token class-name">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <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>'},w.a.createElement(S)),w.a.createElement(D,{title:"菜单类型",id:"Demotype",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Cascader</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</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">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 value<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">\'330000\'</span><span class="token punctuation">,</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span> <span class="token string">\'330106\'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n options<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'浙江省\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330106\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'西湖区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330200\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'温州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330206\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'龙湾区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'新疆维吾尔自治区\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'博尔塔拉蒙古自治州\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120111\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'阿拉山口市\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">success</span><span class="token punctuation">(</span><span class="token known-class-name class-name">JSON</span><span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\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 value<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token arrow operator">=></span> item<span class="token punctuation">.</span><span class="token property-access">id</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">render</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 class="token class-name">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><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>menu<span class="token punctuation">\'</span></span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <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>'},w.a.createElement(E)),w.a.createElement(D,{title:"选中即时改变",id:"Demochoosen",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Cascader</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</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">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 value<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">\'330000\'</span><span class="token punctuation">,</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span> <span class="token string">\'330106\'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n options<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'浙江省\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330106\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'西湖区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'新疆维吾尔自治区\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'博尔塔拉蒙古自治州\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120111\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'阿拉山口市\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data</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>\n value<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token arrow operator">=></span> item<span class="token punctuation">.</span><span class="token property-access">id</span><span class="token punctuation">)</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 maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">success</span><span class="token punctuation">(</span><span class="token known-class-name class-name">JSON</span><span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>data<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">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">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">changeOnSelect</span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span> <span class="token punctuation">/></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</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">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">displayText</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token parameter">value</span> <span class="token arrow operator">=></span> <span class="token punctuation">(</span>value <span class="token operator">&&</span> value<span class="token punctuation">.</span><span class="token property-access">length</span> <span class="token operator">></span> <span class="token number">0</span> <span class="token operator">?</span> value<span class="token punctuation">[</span>value<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><span class="token property-access">title</span> <span class="token operator">:</span> <span class="token string">\'\'</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">changeOnSelect</span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <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>'},w.a.createElement(j)),w.a.createElement(D,{title:"动态加载数据 (tabs)",id:"Demodynamic",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Cascader</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</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">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 value<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n options<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'浙江省\'</span><span class="token punctuation">,</span>\n isLeaf<span class="token operator">:</span> <span class="token boolean">false</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'新疆维吾尔自治区\'</span><span class="token punctuation">,</span>\n isLeaf<span class="token operator">:</span> <span class="token boolean">false</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">loadMore</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">root<span class="token punctuation">,</span> stage</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">resolve<span class="token punctuation">,</span> reject</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token function">setTimeout</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 punctuation">{</span>\n <span class="token keyword">let</span> isLeaf <span class="token operator">=</span> stage <span class="token operator">>=</span> <span class="token number">2</span><span class="token punctuation">;</span>\n <span class="token keyword">let</span> children <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">66666</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>stage<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">Label</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>stage<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>\n isLeaf\n <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n <span class="token function">resolve</span><span class="token punctuation">(</span>children<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">500</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">success</span><span class="token punctuation">(</span><span class="token known-class-name class-name">JSON</span><span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>data<span class="token punctuation">)</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 value<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token arrow operator">=></span> item<span class="token punctuation">.</span><span class="token property-access">id</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">render</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 class="token class-name">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">loadMore</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">loadMore</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">placeholder</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>请选择<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>tabs<span class="token punctuation">"</span></span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <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>'},w.a.createElement(O)),w.a.createElement(D,{title:"动态加载数据 (menu)",id:"Demoloading",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Cascader</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</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">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 value<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n options<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'浙江省\'</span><span class="token punctuation">,</span>\n isLeaf<span class="token operator">:</span> <span class="token boolean">false</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'新疆维吾尔自治区\'</span><span class="token punctuation">,</span>\n isLeaf<span class="token operator">:</span> <span class="token boolean">false</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">loadMore</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">root<span class="token punctuation">,</span> stage</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">resolve<span class="token punctuation">,</span> reject</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token function">setTimeout</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 punctuation">{</span>\n <span class="token keyword">let</span> isLeaf <span class="token operator">=</span> stage <span class="token operator">>=</span> <span class="token number">2</span><span class="token punctuation">;</span>\n <span class="token keyword">let</span> children <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">66666</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>stage<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">Label</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>stage<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>\n isLeaf\n <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n <span class="token function">resolve</span><span class="token punctuation">(</span>children<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">500</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">success</span><span class="token punctuation">(</span><span class="token known-class-name class-name">JSON</span><span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>data<span class="token punctuation">)</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 value<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token arrow operator">=></span> item<span class="token punctuation">.</span><span class="token property-access">id</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">render</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 class="token class-name">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">loadMore</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">loadMore</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">placeholder</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>请选择<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>menu<span class="token punctuation">"</span></span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <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>'},w.a.createElement(M)),w.a.createElement(D,{title:"展开触发类型",id:"Demoexpand",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Cascader</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</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">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 value<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">\'330000\'</span><span class="token punctuation">,</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span> <span class="token string">\'330106\'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n options<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'浙江省\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330106\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'西湖区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330200\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'温州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330206\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'龙湾区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'新疆维吾尔自治区\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'博尔塔拉蒙古自治州\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120111\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'阿拉山口市\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">success</span><span class="token punctuation">(</span><span class="token known-class-name class-name">JSON</span><span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\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 value<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token arrow operator">=></span> item<span class="token punctuation">.</span><span class="token property-access">id</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">render</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 class="token class-name">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><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>menu<span class="token punctuation">\'</span></span>\n <span class="token attr-name">expandTrigger</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token string">\'hover\'</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <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>'},w.a.createElement(z)),w.a.createElement(D,{title:"禁用",id:"Demodisabled",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Cascader</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</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">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 value<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">\'330000\'</span><span class="token punctuation">,</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span> <span class="token string">\'330106\'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n options<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'浙江省\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330106\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'西湖区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330200\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'温州市\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'330206\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'龙湾区\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'新疆维吾尔自治区\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120100\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'博尔塔拉蒙古自治州\'</span><span class="token punctuation">,</span>\n children<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'120111\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'阿拉山口市\'</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">success</span><span class="token punctuation">(</span><span class="token known-class-name class-name">JSON</span><span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\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 value<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token arrow operator">=></span> item<span class="token punctuation">.</span><span class="token property-access">id</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">render</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 class="token class-name">Cascader</span></span>\n <span class="token attr-name">value</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">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">options</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">state</span><span class="token punctuation">.</span><span class="token property-access">options</span><span class="token punctuation">}</span></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">onChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">title</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span>\n <span class="token string">\'省\'</span><span class="token punctuation">,</span>\n <span class="token string">\'市\'</span><span class="token punctuation">,</span>\n <span class="token string">\'区\'</span>\n <span class="token punctuation">]</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">disabled</span>\n <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>'},w.a.createElement(L)),w.a.createElement(R,{html:"<h3 class=\"anchor-heading\"><a href=\"#api\">¶</a><a href=\"javascript:void(0)\" id=\"api\" class=\"anchor-point\"></a>API</h3>\n<h4 class=\"anchor-heading\"><a href=\"#cascader\">¶</a><a href=\"javascript:void(0)\" id=\"cascader\" class=\"anchor-point\"></a>Cascader</h4>\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>value</td>\n<td>级联的选中值</td>\n<td>array</td>\n<td>[]</td>\n<td>''</td>\n</tr>\n<tr>\n<td>type</td>\n<td>UI 类型,有标签形式和菜单形式</td>\n<td>string</td>\n<td><code>'tabs'</code></td>\n<td><code>'menu'</code></td>\n</tr>\n<tr>\n<td>options</td>\n<td>可选项数据源</td>\n<td>array</td>\n<td>[]</td>\n<td>''</td>\n</tr>\n<tr>\n<td>title</td>\n<td>tab子项的标题,每一项的默认值是 \n<code>标题</code></td>\n<td>array</td>\n<td>[]</td>\n<td>''</td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>数据变化时的回调</td>\n<td>func</td>\n<td>noop</td>\n<td>''</td>\n</tr>\n<tr>\n<td>loadMore</td>\n<td>动态加载级联的数据,返回值需为 Promise</td>\n<td>func</td>\n<td>-</td>\n<td>''</td>\n</tr>\n<tr>\n<td>changeOnSelect</td>\n<td>是否选择即触发改变</td>\n<td>boolean</td>\n<td>false</td>\n<td>''</td>\n</tr>\n<tr>\n<td>expandTrigger</td>\n<td>次级菜单的展开方式,可选 'click' 和 'hover', 只针对type='menu'</td>\n<td>string</td>\n<td>'click'</td>\n<td>'hover'</td>\n</tr>\n<tr>\n<td>placeholder</td>\n<td>输入框占位文本</td>\n<td>string</td>\n<td>'请选择'</td>\n<td>''</td>\n</tr>\n<tr>\n<td>className</td>\n<td>自定义额外类名</td>\n<td>string</td>\n<td>''</td>\n<td>''</td>\n</tr>\n<tr>\n<td>popClassName</td>\n<td>popover自定义类名</td>\n<td>string</td>\n<td>''zent-cascader__popup''</td>\n<td>''</td>\n</tr>\n<tr>\n<td>displayText</td>\n<td>用于自定义选中展示文字的函数, selectedOptionArray => text</td>\n<td>func</td>\n<td>-</td>\n<td></td>\n</tr>\n<tr>\n<td>disabled</td>\n<td>是否禁用</td>\n<td>boolean</td>\n<td>false</td>\n<td>true</td>\n</tr>\n</tbody>\n</table>\n<ul>\n<li>级联数据可以通过初始时传入全量 <code>options</code> ,也可以通过 <code>loadMore</code> 动态加载</li>\n<li>通过 <code>loadMore</code> 加载数据时,参数 <code>root</code> 表示当前点击元素的数据对象,<code>stage</code> 表示当前是第几层级</li>\n<li>参数 <code>isLeaf</code> 是配合 <code>loadMore</code> 使用的,表示点击该节点时是否不再继续发请求</li>\n</ul>"}))}}]),a}(v.Component)}}]);