-
Notifications
You must be signed in to change notification settings - Fork 0
/
145-9c128e7e1f8e9241073d.js
1 lines (1 loc) · 82.9 KB
/
145-9c128e7e1f8e9241073d.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[145],{901:function(n,a,s){"use strict";s.r(a),s.d(a,"default",(function(){return q}));var t=s(846),p=s.n(t),o=s(847),e=s.n(o),c=s(840),l=s.n(c),u=s(841),k=s.n(u),r=s(521),i=s.n(r),d=s(842),m=s.n(d),y=s(843),h=s.n(y),g=s(844),f=s.n(g),b=s(845),v=s.n(b),w=s(0),D=s.n(w),T=s(210),E=s(145);function j(n,a){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.push.apply(s,t)}return s}function C(n){for(var a=1;a<arguments.length;a++){var s=null!=arguments[a]?arguments[a]:{};a%2?j(Object(s),!0).forEach((function(a){v()(n,a,s[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):j(Object(s)).forEach((function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))}))}return n}function I(n){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}();return function(){var s,t=f()(n);if(a){var p=f()(this).constructor;s=Reflect.construct(t,arguments,p)}else s=t.apply(this,arguments);return h()(this,s)}}var z=function(){return D.a.createElement(E.Tree,{data:[{id:1,title:"杭州有赞科技有限公司",children:[{id:2,title:"技术",children:[{id:3,title:"后端"},{id:4,title:"运维"},{id:5,title:"前端"}]},{id:6,title:"产品"}]}]})},R=function(){return D.a.createElement(E.Tree,{dataType:"plain",data:[{id:1,title:"杭州有赞科技有限公司"},{id:2,title:"技术",parentId:1},{id:3,title:"后端",parentId:2},{id:4,title:"运维",parentId:2},{id:5,title:"前端",parentId:2},{id:6,title:"产品",parentId:1}]})},S=function(){var n=[{id:1,title:"杭州有赞科技有限公司",children:[{id:2,title:"技术",children:[{id:3,title:"后端"},{id:4,title:"运维"},{id:5,title:"前端"}]},{id:6,title:"产品"}]}];return D.a.createElement("div",null,D.a.createElement(E.Tree,{data:n,size:"small"}),D.a.createElement(E.Tree,{data:n}),D.a.createElement(E.Tree,{data:n,size:"large"}))},O=function(){var n=[{id:1,title:"杭州有赞科技有限公司",content:"移动零售服务商",children:[{id:2,title:"技术",content:"职位介绍http://job.youzan.com",children:[{id:3,title:"后端"},{id:4,title:"运维"},{id:5,title:"前端"}]},{id:6,title:"产品",content:D.a.createElement("a",{href:"http://job.youzan.com"},"'请将简历发送至 [email protected]'")}]}];return D.a.createElement(E.Tree,{data:n,render:function(n){return D.a.createElement("span",{style:{fontSize:16,margin:0,lineHeight:1}},n.title,n.content?D.a.createElement("small",{style:{display:"block",fontSize:10}},n.content):"")}})},N=function(){var n=E.Radio.Group,a=[{id:1,title:"杭州有赞科技有限公司"},{id:2,title:"技术",parentId:1},{id:3,title:"后端",parentId:2},{id:4,title:"运维",parentId:2},{id:5,title:"前端",parentId:2},{id:6,title:"产品",parentId:1}],s=function n(a){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],p={id:String(Math.random()).replace("0.",""),parentId:s,title:a.title};t.push(p);for(var o=0,e=a.children&&a.children.length||0;o<e;o++)n(a.children[o],p.id,t);return t},t=function(t){m()(o,t);var p=I(o);function o(){var n;l()(this,o);for(var t=arguments.length,c=new Array(t),u=0;u<t;u++)c[u]=arguments[u];return n=p.call.apply(p,[this].concat(c)),v()(i()(n),"state",{treeData:a,copyType:"shallow"}),v()(i()(n),"onDelete",(function(a){n.setState({treeData:n.state.treeData.filter((function(n){return n.id!==a.id}))})})),v()(i()(n),"onClone",(function(a){var t=n.state.copyType;if("shallow"===t){var p=Object.assign({},a,{id:Date.now()});n.setState({treeData:[].concat(e()(n.state.treeData),[p])})}else if("deep"===t){var o=s(a,a.parentId);n.setState({treeData:[].concat(e()(n.state.treeData),e()(o))})}})),v()(i()(n),"onCopyTypeChange",(function(a){return n.setState({copyType:a.target.value})})),n}return k()(o,[{key:"render",value:function(){var a=this.state,s=a.copyType,t=a.treeData,p=[{name:"Delete",icon:D.a.createElement(E.Icon,{type:"close"}),action:this.onDelete},{name:"Clone",icon:D.a.createElement(E.Icon,{type:"plus"}),action:this.onClone}];return D.a.createElement("div",null,D.a.createElement(n,{onChange:this.onCopyTypeChange,value:s},D.a.createElement(E.Radio,{value:"shallow"},"浅拷贝"),D.a.createElement(E.Radio,{value:"deep"},"深拷贝")),D.a.createElement("hr",null),D.a.createElement(E.Tree,{data:t,dataType:"plain",operations:p}))}}]),o}(D.a.Component);return D.a.createElement(t,null)},M=function(){var n=[{id:1,title:"杭州有赞科技有限公司",children:[{id:2,title:"技术",children:[{id:3,title:"后端",children:[{id:7,title:"JAVA"},{id:8,title:"PHP"},{id:9,title:"GO"},{id:10,title:".NET"}]},{id:4,title:"运维"},{id:5,title:"前端"}]},{id:6,title:"产品"}]}],a=function(a){m()(t,a);var s=I(t);function t(){var n;l()(this,t);for(var a=arguments.length,p=new Array(a),o=0;o<a;o++)p[o]=arguments[o];return n=s.call.apply(s,[this].concat(p)),v()(i()(n),"state",{checkedKeys:[3,5,22],disabledCheckedKeys:[4,7,9,22]}),v()(i()(n),"onCheck",(function(a,s){console.log(a,s),n.setState({checkedKeys:a})})),n}return k()(t,[{key:"render",value:function(){var a=this.state,s=a.checkedKeys,t=a.disabledCheckedKeys;return D.a.createElement("div",null,D.a.createElement(E.Tree,{checkable:!0,size:"small",data:n,onCheck:this.onCheck,checkedKeys:s,disabledCheckedKeys:t}))}}]),t}(D.a.Component);return D.a.createElement(a,null)},K=function(){var n=function(n,a){n.level<4?setTimeout((function(){for(var s=[],t=Number(n.title.split("-")[0]),p=Math.pow(10,3-n.level),o=n.level+1,e=0,c="",l=!1;e<=9;e++)4===o?(c=String(t+e),l=!0):(c="".concat(t+p*e,"-").concat(t+p*(e+1)),l=!1),s.push({id:c,level:o,title:c,isLeaf:l});a(s)}),200):setTimeout((function(){return a([])}),200)},a=function(a){m()(t,a);var s=I(t);function t(){var a;l()(this,t);for(var p=arguments.length,o=new Array(p),c=0;c<p;c++)o[c]=arguments[c];return a=s.call.apply(s,[this].concat(o)),v()(i()(a),"state",{treeData:[]}),v()(i()(a),"loadMore",(function(s){return new Promise((function(t,p){n(s,(function(n){var p=n.map((function(n){return C(C({},n),{},{parentId:s.id})}));a.setState({treeData:[].concat(e()(a.state.treeData),e()(p))}),t()}))}))})),a}return k()(t,[{key:"componentDidMount",value:function(){var a=this,s={id:"1-0-10000",title:"0-10000",level:0,expand:!0};n(s,(function(n){var t=n.map((function(n){return C(C({},n),{},{parentId:s.id})}));a.setState({treeData:[s].concat(e()(t))})}))}},{key:"render",value:function(){var n=this.state.treeData;return D.a.createElement(E.Tree,{dataType:"plain",data:n,loadMore:this.loadMore})}}]),t}(D.a.Component);return D.a.createElement(a,null)};function x(n){return D.a.createElement(n.tag,p()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function P(n){return D.a.createElement(x,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function A(n){return D.a.createElement(x,{tag:"style",html:n.style})}var _=function(n){m()(s,n);var a=I(s);function s(){var n;l()(this,s);for(var t=arguments.length,p=new Array(t),o=0;o<t;o++)p[o]=arguments[o];return n=a.call.apply(a,[this].concat(p)),v()(i()(n),"state",{showCode:!1}),v()(i()(n),"toggle",(function(){n.setState({showCode:!n.state.showCode})})),n}return k()(s,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,p=a.children;return D.a.createElement("div",{className:"zandoc-react-demo"},D.a.createElement("div",{className:"zandoc-react-demo__preview"},p),D.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},D.a.createElement("div",{className:"zandoc-react-demo__title"},D.a.createElement("p",null,s||"")),D.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&&D.a.createElement("pre",{className:"zandoc-react-demo__code"},D.a.createElement(x,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),s}(w.Component),q=function(n){m()(s,n);var a=I(s);function s(){return l()(this,s),a.apply(this,arguments)}return k()(s,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&Object(T.a)(document.documentElement,0,function n(a,s){for(;a;)return a.offsetTop&&"static"!==getComputedStyle(a).position&&(s+=a.offsetTop),n(a.parentNode,s);return s}(a,-9))}}},{key:"render",value:function(){return D.a.createElement("div",{className:"zandoc-react-container",key:null},D.a.createElement(A,{style:""}),D.a.createElement(P,{html:'<h2 class="anchor-heading"><a href="#tree-shu">¶</a><a href="javascript:void(0)" id="tree-shu" class="anchor-point"></a>Tree 树</h2>\n<p>树形控件,展示文件结构、组织架构、地理信息等分层数据的控件。</p>\n<h3 class="anchor-heading"><a href="#shi-yong-zhi-nan">¶</a><a href="javascript:void(0)" id="shi-yong-zhi-nan" class="anchor-point"></a>使用指南</h3>\n<ul>\n<li>支持两种数据格式,递归树形结构和单层列表结构。</li>\n<li>组件展示对应传入的data属性,内部不会改变data,具体请看自定义操作的例子。</li>\n</ul>\n<h3 class="anchor-heading"><a href="#dai-ma-yan-shi">¶</a><a href="javascript:void(0)" id="dai-ma-yan-shi" class="anchor-point"></a>代码演示</h3>'}),D.a.createElement(_,{title:"基础用法",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tree</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">const</span> treeData <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 number">1</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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">2</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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'后端\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'运维\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'前端\'</span>\n <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 id<span class="token operator">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'产品\'</span>\n <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\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">Tree</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</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>'},D.a.createElement(z)),D.a.createElement(_,{title:"列表格式数据源",id:"Demoarraydata",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tree</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">const</span> treeData <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 number">1</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州有赞科技有限公司\'</span><span class="token punctuation">,</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'技术\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'后端\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'运维\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'前端\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'产品\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><span class="token punctuation">]</span><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">Tree</span></span> <span class="token attr-name">dataType</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>plain<span class="token punctuation">"</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},D.a.createElement(R)),D.a.createElement(_,{title:"三种大小",id:"Demosize",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tree</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">const</span> treeData <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 number">1</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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">2</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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'后端\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'运维\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'前端\'</span>\n <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 id<span class="token operator">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'产品\'</span>\n <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\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>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">Tree</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">size</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> <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">Tree</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<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">Tree</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>large<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},D.a.createElement(S)),D.a.createElement(_,{title:"自定义节点展示",id:"Democustomnode",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tree</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">const</span> treeData <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 number">1</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州有赞科技有限公司\'</span><span class="token punctuation">,</span>\n content<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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'技术\'</span><span class="token punctuation">,</span>\n content<span class="token operator">:</span> <span class="token string">\'职位介绍http://job.youzan.com\'</span><span class="token punctuation">,</span>\n 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 number">3</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'后端\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'运维\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'前端\'</span>\n <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 id<span class="token operator">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'产品\'</span><span class="token punctuation">,</span>\n content<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>http://job.youzan.com<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token string">\'请将简历发送至 [email protected]\'</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</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><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n<span class="token keyword">const</span> <span class="token function-variable function">customRender</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 tag"><span class="token tag"><span class="token punctuation"><</span>span</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> fontSize<span class="token operator">:</span> <span class="token number">16</span><span class="token punctuation">,</span> margin<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span> lineHeight<span class="token operator">:</span> <span class="token number">1</span> <span class="token punctuation">}</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>data<span class="token punctuation">.</span><span class="token property-access">title</span><span class="token punctuation">}</span>\n <span class="token punctuation">{</span>data<span class="token punctuation">.</span><span class="token property-access">content</span> <span class="token operator">?</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>small</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> display<span class="token operator">:</span> <span class="token string">\'block\'</span><span class="token punctuation">,</span> fontSize<span class="token operator">:</span> <span class="token number">10</span> <span class="token punctuation">}</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>data<span class="token punctuation">.</span><span class="token property-access">content</span><span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>small</span><span class="token punctuation">></span></span> <span class="token operator">:</span> <span class="token string">\'\'</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>\n<span class="token punctuation">)</span><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">Tree</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">render</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>customRender<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},D.a.createElement(O)),D.a.createElement(_,{title:"自定义操作",id:"Democustomoperate",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tree</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Radio</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">const</span> <span class="token maybe-class-name">RadioGroup</span> <span class="token operator">=</span> <span class="token maybe-class-name">Radio</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Group</span></span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> originData <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 number">1</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'杭州有赞科技有限公司\'</span><span class="token punctuation">,</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'技术\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'后端\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'运维\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'前端\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'产品\'</span><span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n<span class="token keyword">const</span> <span class="token function-variable function">deepClone</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">node<span class="token punctuation">,</span> parentId <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> nodeArray <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span></span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> copyNode <span class="token operator">=</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token known-class-name class-name">String</span><span class="token punctuation">(</span><span class="token known-class-name class-name">Math</span><span class="token punctuation">.</span><span class="token method function property-access">random</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token method function property-access">replace</span><span class="token punctuation">(</span><span class="token string">\'0.\'</span><span class="token punctuation">,</span> <span class="token string">\'\'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">,</span>\n title<span class="token operator">:</span> node<span class="token punctuation">.</span><span class="token property-access">title</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n nodeArray<span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span>copyNode<span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> l <span class="token operator">=</span> node<span class="token punctuation">.</span><span class="token property-access">children</span> <span class="token operator">&&</span> node<span class="token punctuation">.</span><span class="token property-access">children</span><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 punctuation">;</span> i <span class="token operator"><</span> l<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token function">deepClone</span><span class="token punctuation">(</span>node<span class="token punctuation">.</span><span class="token property-access">children</span><span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">,</span> copyNode<span class="token punctuation">.</span><span class="token property-access">id</span><span class="token punctuation">,</span> nodeArray<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token keyword">return</span> nodeArray<span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">class</span> <span class="token class-name">TreeExample</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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n treeData<span class="token operator">:</span> originData<span class="token punctuation">,</span>\n copyType<span class="token operator">:</span> <span class="token string">\'shallow\'</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onDelete</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 treeData<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><span class="token property-access">treeData</span><span class="token punctuation">.</span><span class="token method function property-access">filter</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 operator">!==</span> data<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><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onClone</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">const</span> <span class="token punctuation">{</span> copyType <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\n <span class="token keyword">if</span> <span class="token punctuation">(</span>copyType <span class="token operator">===</span> <span class="token string">\'shallow\'</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> node <span class="token operator">=</span> <span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">assign</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> data<span class="token punctuation">,</span> <span class="token punctuation">{</span> id<span class="token operator">:</span> <span class="token known-class-name class-name">Date</span><span class="token punctuation">.</span><span class="token method function property-access">now</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">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 treeData<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token spread 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><span class="token property-access">treeData</span><span class="token punctuation">,</span> node<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> <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>copyType <span class="token operator">===</span> <span class="token string">\'deep\'</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> nodeArray <span class="token operator">=</span> <span class="token function">deepClone</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span> data<span class="token punctuation">.</span><span class="token property-access">parentId</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 treeData<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token spread 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><span class="token property-access">treeData</span><span class="token punctuation">,</span> <span class="token spread operator">...</span>nodeArray<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 <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onCopyTypeChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">e</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">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> copyType<span class="token operator">:</span> e<span class="token punctuation">.</span><span class="token property-access">target</span><span class="token punctuation">.</span><span class="token property-access">value</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><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> copyType<span class="token punctuation">,</span> treeData <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> operations <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n name<span class="token operator">:</span> <span class="token string">\'Delete\'</span><span class="token punctuation">,</span>\n icon<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Icon</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>close<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n action<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onDelete</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n name<span class="token operator">:</span> <span class="token string">\'Clone\'</span><span class="token punctuation">,</span>\n icon<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Icon</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>plus<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n action<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onClone</span>\n <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">RadioGroup</span></span> <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">onCopyTypeChange</span><span class="token punctuation">}</span></span> <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>copyType<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">Radio</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>shallow<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">Radio</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">Radio</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>deep<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">Radio</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">RadioGroup</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>hr</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">Tree</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">dataType</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>plain<span class="token punctuation">"</span></span> <span class="token attr-name">operations</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>operations<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<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">TreeExample</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},D.a.createElement(N)),D.a.createElement(_,{title:"可选树",id:"Demooption",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tree</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">const</span> treeData <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 number">1</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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">2</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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">3</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><span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">7</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'JAVA\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">8</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'PHP\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">9</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'GO\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">10</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'.NET\'</span>\n <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 id<span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'运维\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'前端\'</span>\n <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 id<span class="token operator">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'产品\'</span>\n <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\n<span class="token keyword">class</span> <span class="token class-name">TreeExample</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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n checkedKeys<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">22</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n disabledCheckedKeys<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token number">9</span><span class="token punctuation">,</span> <span class="token number">22</span><span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onCheck</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">checked<span class="token punctuation">,</span> helpInfo</span><span class="token punctuation">)</span> <span class="token arrow operator">=></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>checked<span class="token punctuation">,</span> helpInfo<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 checkedKeys<span class="token operator">:</span> checked\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> checkedKeys<span class="token punctuation">,</span> disabledCheckedKeys <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\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">Tree</span></span>\n <span class="token attr-name">checkable</span>\n <span class="token attr-name">size</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">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span>\n <span class="token attr-name">onCheck</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">onCheck</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">checkedKeys</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>checkedKeys<span class="token punctuation">}</span></span>\n <span class="token attr-name">disabledCheckedKeys</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>disabledCheckedKeys<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">TreeExample</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},D.a.createElement(M)),D.a.createElement(_,{title:"异步加载",id:"Demoasync",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tree</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">const</span> <span class="token function-variable function">fetchData</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">data<span class="token punctuation">,</span> callback</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>data<span class="token punctuation">.</span><span class="token property-access">level</span> <span class="token operator"><</span> <span class="token number">4</span><span class="token punctuation">)</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">const</span> resData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> base <span class="token operator">=</span> <span class="token known-class-name class-name">Number</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span><span class="token property-access">title</span><span class="token punctuation">.</span><span class="token method function property-access">split</span><span class="token punctuation">(</span><span class="token string">\'-\'</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> step <span class="token operator">=</span> <span class="token known-class-name class-name">Math</span><span class="token punctuation">.</span><span class="token method function property-access">pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">3</span> <span class="token operator">-</span> data<span class="token punctuation">.</span><span class="token property-access">level</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> level <span class="token operator">=</span> data<span class="token punctuation">.</span><span class="token property-access">level</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>\n <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> id <span class="token operator">=</span> <span class="token string">\'\'</span><span class="token punctuation">,</span> isLeaf <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span> i <span class="token operator"><=</span> <span class="token number">9</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>level <span class="token operator">===</span> <span class="token number">4</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n id <span class="token operator">=</span> <span class="token known-class-name class-name">String</span><span class="token punctuation">(</span>base <span class="token operator">+</span> i<span class="token punctuation">)</span><span class="token punctuation">;</span>\n isLeaf <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span> <span class="token keyword">else</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 interpolation"><span class="token interpolation-punctuation punctuation">${</span>base <span class="token operator">+</span> step <span class="token operator">*</span> i<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">-</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>base <span class="token operator">+</span> step <span class="token operator">*</span> <span class="token punctuation">(</span>i <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">;</span>\n isLeaf <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n resData<span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span> id<span class="token punctuation">,</span> level<span class="token punctuation">,</span> title<span class="token operator">:</span> id<span class="token punctuation">,</span> isLeaf <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token function">callback</span><span class="token punctuation">(</span>resData<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">200</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span> <span class="token keyword">else</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 function">callback</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">200</span><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 keyword">class</span> <span class="token class-name">TreeExample</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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n treeData<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">componentDidMount</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> rootData <span class="token operator">=</span> <span class="token punctuation">{</span>\n id<span class="token operator">:</span> <span class="token string">\'1-0-10000\'</span><span class="token punctuation">,</span>\n title<span class="token operator">:</span> <span class="token string">\'0-10000\'</span><span class="token punctuation">,</span>\n level<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>\n expand<span class="token operator">:</span> <span class="token boolean">true</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n <span class="token function">fetchData</span><span class="token punctuation">(</span>rootData<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">resData</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> newData <span class="token operator">=</span> resData<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> <span class="token punctuation">(</span><span class="token punctuation">{</span>\n <span class="token spread operator">...</span>item<span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> rootData<span class="token punctuation">.</span><span class="token property-access">id</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">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 treeData<span class="token operator">:</span> <span class="token punctuation">[</span>rootData<span class="token punctuation">,</span> <span class="token spread operator">...</span>newData<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><span class="token punctuation">)</span><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">data</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">fetchData</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">resData</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> newData <span class="token operator">=</span> resData<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> <span class="token punctuation">(</span><span class="token punctuation">{</span>\n <span class="token spread operator">...</span>item<span class="token punctuation">,</span>\n parentId<span class="token operator">:</span> data<span class="token punctuation">.</span><span class="token property-access">id</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">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> treeData<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token spread 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><span class="token property-access">treeData</span><span class="token punctuation">,</span> <span class="token spread operator">...</span>newData<span class="token punctuation">]</span> <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><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 punctuation">}</span><span class="token punctuation">)</span><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> treeData <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">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Tree</span></span> <span class="token attr-name">dataType</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>plain<span class="token punctuation">"</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <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> <span class="token punctuation">/></span></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">TreeExample</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>'},D.a.createElement(K)),D.a.createElement(P,{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="#tree">¶</a><a href="javascript:void(0)" id="tree" class="anchor-point"></a>Tree</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>dataType</td>\n<td>数据类型, 默认为tree类型</td>\n<td>string</td>\n<td><code>\'tree\'</code></td>\n<td><code>\'plain\'</code></td>\n</tr>\n<tr>\n<td>data</td>\n<td>必填, 实际传入的数据, 根据dataType进行识别</td>\n<td>array</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>renderKey</td>\n<td>渲染节点所用到的key集合, 具体看下表</td>\n<td>object</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>render</td>\n<td>自定义树条目渲染方法, 传入参数为该节点数据 (包含子树)</td>\n<td>func(data)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>operations</td>\n<td>自定义操作, 包含 \n<code>name</code>\n, \n<code>icon</code>\n, \n<code>action</code>\n, \n<code>shouldRender</code>\n 属性</td>\n<td>array\n[\nobject\n]</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>foldable</td>\n<td>是否支持点击条目时展开与收起动作</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onCheck</td>\n<td>点击checkbox的回调函数, 接受所选中节点的数组与帮助自定义的信息</td>\n<td>func(ids, helpInfo)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>checkable</td>\n<td>是否支持checkbox选择</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>checkedKeys</td>\n<td>选中节点id数组</td>\n<td>array</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>disabledCheckedKeys</td>\n<td>默认禁选节点id数组</td>\n<td>array</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>size</td>\n<td>大小</td>\n<td>string</td>\n<td><code>\'medium\'</code></td>\n<td><code>\'small\'</code>\n, \n<code>\'large\'</code></td>\n</tr>\n<tr>\n<td>commonStyle</td>\n<td>设置整个tree的外层style</td>\n<td>object</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>expandAll</td>\n<td>是否展开所有节点</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onExpand</td>\n<td>展开节点之后的回调函数</td>\n<td>func(data, config)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>autoExpandOnSelect</td>\n<td>点击节点是否展开</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onSelect</td>\n<td>选择树的一个节点的回调函数</td>\n<td>func(data, target)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>isRoot</td>\n<td>plain数据类型,判断节点是否为根节点的api</td>\n<td>func(node)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>loadMore</td>\n<td>返回Promise的函数,必须支持then的回调, 用于节点异步加载更多内容</td>\n<td>func(data)</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#renderkey">¶</a><a href="javascript:void(0)" id="renderkey" class="anchor-point"></a>renderKey</h4>\n<p>针对 <code>data</code> \b使用到的部分key,定制化。</p>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>Type</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>id</td>\n<td>对应 数据的唯一标识</td>\n<td>string</td>\n<td><code>\'id\'</code></td>\n</tr>\n<tr>\n<td>title</td>\n<td>对应 显示内容</td>\n<td>string</td>\n<td><code>\'title\'</code></td>\n</tr>\n<tr>\n<td>children</td>\n<td>对应 子树 (\n<code>dataType="tree"</code>\n 时生效)</td>\n<td>string</td>\n<td><code>\'children\'</code></td>\n</tr>\n<tr>\n<td>parentId</td>\n<td>对应 父节点Id (\n<code>dataType="plain"</code>\n 时生效)</td>\n<td>string</td>\n<td><code>\'parentId\'</code></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#data">¶</a><a href="javascript:void(0)" id="data" class="anchor-point"></a>data</h4>\n<p>可在每个节点任意添加初下列属性之外的key-value,回调函数中会拿到用户传入的完整数据。\n可以通过<code>renderKey</code>, 定制key。</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>id</td>\n<td>必填, 数据的唯一标识</td>\n<td>number/string</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>title</td>\n<td>必填, 显示内容</td>\n<td>string</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>children</td>\n<td>子树 (\n<code>dataType="tree"</code>\n 时生效)</td>\n<td>array\n[\nobject\n]</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>parentId</td>\n<td>父节点Id (\n<code>dataType="plain"</code>\n 时生效), 根节点为0或不定义</td>\n<td>number/string</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>expand</td>\n<td>是否展开</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>isLeaf</td>\n<td>是否叶子节点</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#operations">¶</a><a href="javascript:void(0)" id="operations" class="anchor-point"></a>operations</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>name</td>\n<td>必填,显示内容</td>\n<td>string</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>icon</td>\n<td>显示icon的className, 或ReactNode</td>\n<td>string/ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>action</td>\n<td>必填,点击回调函数,参数为子树信息</td>\n<td>func(data)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>shouldRender</td>\n<td>是否更新,返回true/false</td>\n<td>func(data)</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n</tbody>\n</table>'}))}}]),s}(w.Component)}}]);