-
Notifications
You must be signed in to change notification settings - Fork 0
/
135-9c128e7e1f8e9241073d.js
1 lines (1 loc) · 110 KB
/
135-9c128e7e1f8e9241073d.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[135],{900:function(n,a,s){"use strict";s.r(a),s.d(a,"default",(function(){return R}));var t=s(846),p=s.n(t),e=s(840),o=s.n(e),c=s(841),l=s.n(c),u=s(521),k=s.n(u),i=s(842),r=s.n(i),d=s(843),m=s.n(d),g=s(844),b=s.n(g),y=s(845),h=s.n(y),v=s(0),f=s.n(v),T=s(210),w=s(145);function C(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=b()(n);if(a){var p=b()(this).constructor;s=Reflect.construct(t,arguments,p)}else s=t.apply(this,arguments);return m()(this,s)}}var E=function(){var n=w.Tabs.TabPanel,a=function(a){r()(t,a);var s=C(t);function t(){var n;o()(this,t);for(var a=arguments.length,p=new Array(a),e=0;e<a;e++)p[e]=arguments[e];return n=s.call.apply(s,[this].concat(p)),h()(k()(n),"state",{activeId:"2"}),h()(k()(n),"onTabChange",(function(a){n.setState({activeId:a})})),n}return l()(t,[{key:"render",value:function(){return f.a.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange,align:"right"},f.a.createElement(n,{tab:f.a.createElement("span",null,"选项一"),id:"1",disabled:!0},f.a.createElement("div",null,"选项一的内容")),f.a.createElement(n,{tab:"选项二",id:"2"},f.a.createElement("div",null,"选项二的内容")),f.a.createElement(n,{tab:"选项三",id:"3"},f.a.createElement("div",null,"选项三的内容")))}}]),t}(f.a.Component);return f.a.createElement(a,null)},I=function(){var n=function(n){r()(s,n);var a=C(s);function s(n){var t;return o()(this,s),t=a.call(this,n),h()(k()(t),"onTabChange",(function(n){t.setState({activeId:n})})),t.state={activeId:"2",tabs:[{title:"选项一",key:"1",disabled:!0},{title:"选项二",key:"2"},{title:"选项三",key:"3"}]},t}return l()(s,[{key:"render",value:function(){return f.a.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange,tabs:this.state.tabs})}}]),s}(v.Component);return f.a.createElement(n,null)},P=function(){var n=w.Tabs.TabPanel,a=function(a){r()(t,a);var s=C(t);function t(){var n;o()(this,t);for(var a=arguments.length,p=new Array(a),e=0;e<a;e++)p[e]=arguments[e];return n=s.call.apply(s,[this].concat(p)),h()(k()(n),"state",{activeId:"2"}),h()(k()(n),"onTabChange",(function(a){n.setState({activeId:a})})),n}return l()(t,[{key:"render",value:function(){var a=[f.a.createElement(n,{key:"1",tab:f.a.createElement("span",null,"选项一"),id:"1",disabled:!0},f.a.createElement("div",null,"选项一的内容")),f.a.createElement(n,{key:"2",tab:"选项二",id:"2"},f.a.createElement("div",null,"选项二的内容")),f.a.createElement(n,{key:"3",tab:"选项三",id:"3"},f.a.createElement("div",null,"选项三的内容"))];return f.a.createElement("div",{className:"zent-tabs-demo"},f.a.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange,type:"normal"},a),f.a.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange,type:"card"},a),f.a.createElement("div",null,f.a.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange,type:"button"},a)))}}]),t}(f.a.Component);return f.a.createElement(a,null)},j=function(){var n=w.Tabs.TabPanel,a=function(a){r()(t,a);var s=C(t);function t(){var n;o()(this,t);for(var a=arguments.length,p=new Array(a),e=0;e<a;e++)p[e]=arguments[e];return n=s.call.apply(s,[this].concat(p)),h()(k()(n),"state",{activeId:"2",panels:[{tab:f.a.createElement("span",null,"选项1"),id:"1",disabled:!0,content:"选项1的内容"},{tab:f.a.createElement("span",null,"选项2"),id:"2",content:f.a.createElement("div",null,"选项2的内容")}]}),h()(k()(n),"onTabChange",(function(a){n.setState({activeId:a})})),n}return l()(t,[{key:"renderPanels",value:function(){return this.state.panels.map((function(a){return f.a.createElement(n,p()({},a,{key:a.id}),a.content)}))}},{key:"render",value:function(){return f.a.createElement("div",{className:"zent-tabs-demo"},f.a.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange.bind(this),navExtraContent:f.a.createElement("div",{style:{whiteSpace:"nowrap"}},"当前网店:文三路网店")},this.renderPanels()))}}]),t}(f.a.Component);return f.a.createElement(a,null)},q=function(){var n=w.Tabs.TabPanel,a=4,s=function(s){r()(e,s);var t=C(e);function e(){var n;o()(this,e);for(var s=arguments.length,p=new Array(s),c=0;c<s;c++)p[c]=arguments[c];return n=t.call.apply(t,[this].concat(p)),h()(k()(n),"state",{activeId:"2",panels:[{tab:f.a.createElement("span",null,"选项1"),id:"1",disabled:!0,content:"选项1的内容"},{tab:f.a.createElement("span",null,"选项2"),id:"2",content:f.a.createElement("div",null,"选项2的内容")}]}),h()(k()(n),"onTabAdd",(function(){var s=n.state.panels;s.push({tab:"选项".concat(a),id:"".concat(a++),content:Date.now()}),n.setState({panels:s})})),h()(k()(n),"onTabDel",(function(a){var s=n.state.panels;n.setState({panels:s.filter((function(n,s){return n.id!==a}))})})),h()(k()(n),"onTabChange",(function(a){n.setState({activeId:a})})),n}return l()(e,[{key:"renderPanels",value:function(){return this.state.panels.map((function(a){return f.a.createElement(n,p()({},a,{key:a.id}),a.content)}))}},{key:"render",value:function(){var n=this.renderPanels();return f.a.createElement("div",{className:"zent-tabs-demo"},f.a.createElement(w.Tabs,{candel:!0,activeId:this.state.activeId,onChange:this.onTabChange,onDelete:this.onTabDel,navExtraContent:f.a.createElement(w.Icon,{type:"plus",className:"zent-tabs-add-btn",onClick:this.onTabAdd})},n),f.a.createElement(w.Tabs,{candel:!0,type:"card",activeId:this.state.activeId,onChange:this.onTabChange,onDelete:this.onTabDel,navExtraContent:f.a.createElement(w.Icon,{type:"plus",className:"zent-tabs-add-btn",onClick:this.onTabAdd})},n),f.a.createElement("div",{style:{marginTop:16}},"candel 属性只有在 normal 和 card 两种模式下起效"))}}]),e}(f.a.Component);return f.a.createElement(s,null)},D=function(){var n=w.Tabs.TabPanel,a=4,s=function(s){r()(e,s);var t=C(e);function e(){var n;o()(this,e);for(var s=arguments.length,p=new Array(s),c=0;c<s;c++)p[c]=arguments[c];return n=t.call.apply(t,[this].concat(p)),h()(k()(n),"state",{activeId:"2",panels:[{tab:f.a.createElement("span",null,"选项1"),id:"1",disabled:!0,content:"选项1的内容"},{tab:f.a.createElement("span",null,"选项2"),id:"2",content:f.a.createElement("div",null,"选项2的内容")}]}),h()(k()(n),"onTabAdd",(function(){var s=n.state.panels;s.push({tab:"选项".concat(a),id:"".concat(a++),content:Date.now()}),n.setState({panels:s})})),h()(k()(n),"onTabDel",(function(a){var s=n.state.panels;n.setState({panels:s.filter((function(n,s){return n.id!==a}))})})),h()(k()(n),"onTabChange",(function(a){n.setState({activeId:a})})),n}return l()(e,[{key:"renderPanels",value:function(){return this.state.panels.map((function(a){return f.a.createElement(n,p()({},a,{key:a.id}),a.content)}))}},{key:"render",value:function(){var n=this.renderPanels();return f.a.createElement("div",{className:"zent-tabs-demo"},f.a.createElement(w.Tabs,{candel:!0,stretch:!0,activeId:this.state.activeId,onChange:this.onTabChange,onDelete:this.onTabDel,navExtraContent:f.a.createElement(w.Icon,{type:"plus",className:"zent-tabs-add-btn",onClick:this.onTabAdd})},n),f.a.createElement(w.Tabs,{candel:!0,stretch:!0,type:"card",activeId:this.state.activeId,onChange:this.onTabChange,onDelete:this.onTabDel,navExtraContent:f.a.createElement(w.Icon,{type:"plus",className:"zent-tabs-add-btn",onClick:this.onTabAdd})},n),f.a.createElement(w.Tabs,{stretch:!0,type:"button",activeId:this.state.activeId,onChange:this.onTabChange,navExtraContent:f.a.createElement(w.Icon,{type:"plus",className:"zent-tabs-add-btn",onClick:this.onTabAdd})},n))}}]),e}(f.a.Component);return f.a.createElement(s,null)},z=function(){var n=w.VerticalTabs.TabPanel,a=w.VerticalTabs.Divide,s=function(s){r()(p,s);var t=C(p);function p(n){var a;return o()(this,p),a=t.call(this,n),h()(k()(a),"onTabChange",(function(n){a.setState({activeId:n})})),a.state={activeId:"2"},a}return l()(p,[{key:"render",value:function(){return f.a.createElement("div",{className:"zent-tabs-demo"},f.a.createElement(w.VerticalTabs,{activeId:this.state.activeId,onChange:this.onTabChange},f.a.createElement(n,{tab:f.a.createElement("span",null,"选项1"),id:"1",disabled:!0},f.a.createElement("div",null,"选项一的内容")),f.a.createElement(n,{tab:"选项2",id:"2"},f.a.createElement("div",null,"选项二的内容")),f.a.createElement(a,null),f.a.createElement(n,{tab:"选项3",id:"3"},f.a.createElement("div",null,"选项三的内容"))),f.a.createElement(w.VerticalTabs,{tabs:[{title:"选项1",key:"1",disabled:!0},{title:"选项2",key:"2"},{divide:!0},{title:"选项3",key:"3"}],activeId:this.state.activeId,onChange:this.onTabChange,scrollHeight:100}),f.a.createElement("div",null,"竖直模式下,无法使用内部的删除、对齐、伸展、额外内容等功能"))}}]),p}(v.Component);return f.a.createElement(s,null)};function N(n){return f.a.createElement(n.tag,p()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function S(n){return f.a.createElement(N,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function x(n){return f.a.createElement(N,{tag:"style",html:n.style})}var A=function(n){r()(s,n);var a=C(s);function s(){var n;o()(this,s);for(var t=arguments.length,p=new Array(t),e=0;e<t;e++)p[e]=arguments[e];return n=a.call.apply(a,[this].concat(p)),h()(k()(n),"state",{showCode:!1}),h()(k()(n),"toggle",(function(){n.setState({showCode:!n.state.showCode})})),n}return l()(s,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,p=a.children;return f.a.createElement("div",{className:"zandoc-react-demo"},f.a.createElement("div",{className:"zandoc-react-demo__preview"},p),f.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},f.a.createElement("div",{className:"zandoc-react-demo__title"},f.a.createElement("p",null,s||"")),f.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&&f.a.createElement("pre",{className:"zandoc-react-demo__code"},f.a.createElement(N,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),s}(v.Component),R=function(n){r()(s,n);var a=C(s);function s(){return o()(this,s),a.apply(this,arguments)}return l()(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 f.a.createElement("div",{className:"zandoc-react-container",key:null},f.a.createElement(x,{style:".zent-tabs-demo .zent-tabs {\n\tmargin-bottom: 16px;\n}\n\n.zent-tabs-add-btn {\n\tcursor: pointer;\n}\n\n.zent-tabs-add-btn {\n\tcursor: pointer;\n}"}),f.a.createElement(S,{html:'<h2 class="anchor-heading"><a href="#tabs-xuan-xiang-qia-zu-jian">¶</a><a href="javascript:void(0)" id="tabs-xuan-xiang-qia-zu-jian" class="anchor-point"></a>Tabs 选项卡组件</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>'}),f.a.createElement(A,{title:"基础模式",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tabs</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> <span class="token maybe-class-name">TabPanel</span> <span class="token operator">=</span> <span class="token maybe-class-name">Tabs</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">TabPanel</span></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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token operator">:</span> <span class="token string">\'2\'</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">onTabChange</span> <span class="token operator">=</span> <span class="token parameter">id</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 activeId<span class="token operator">:</span> id<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">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">Tabs</span></span> <span class="token attr-name">activeId</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">activeId</span><span class="token punctuation">}</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">onTabChange</span><span class="token punctuation">}</span></span> <span class="token attr-name">align</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>right<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">TabPanel</span></span> <span class="token attr-name">tab</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项一<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">}</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span> <span class="token attr-name">disabled</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>选项一的内容<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">TabPanel</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">TabPanel</span></span> <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>选项二<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>2<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>选项二的内容<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">TabPanel</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">TabPanel</span></span> <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>选项三<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>3<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>选项三的内容<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">TabPanel</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">Tabs</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Simple</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},f.a.createElement(E)),f.a.createElement(A,{title:"不使用TabPanel,只使用Tab展示导航",id:"Demonotabpanel",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tabs</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">Component</span> <span class="token punctuation">{</span>\n <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">super</span><span class="token punctuation">(</span>props<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 property-access">state</span> <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token operator">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n tabs<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n title<span class="token operator">:</span> <span class="token string">\'选项一\'</span><span class="token punctuation">,</span>\n key<span class="token operator">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<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 punctuation">,</span>\n <span class="token punctuation">{</span>\n title<span class="token operator">:</span> <span class="token string">\'选项二\'</span><span class="token punctuation">,</span>\n key<span class="token operator">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n title<span class="token operator">:</span> <span class="token string">\'选项三\'</span><span class="token punctuation">,</span>\n key<span class="token operator">:</span> <span class="token string">\'3\'</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>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token parameter">id</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 activeId<span class="token operator">:</span> id<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">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">Tabs</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">tabs</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">tabs</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><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><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},f.a.createElement(I)),f.a.createElement(A,{title:"普通、卡片、按钮类型",id:"Demotypes",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tabs</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> <span class="token maybe-class-name">TabPanel</span> <span class="token operator">=</span> <span class="token maybe-class-name">Tabs</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">TabPanel</span></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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token operator">:</span> <span class="token string">\'2\'</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">onTabChange</span> <span class="token operator">=</span> <span class="token parameter">id</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 activeId<span class="token operator">:</span> id<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">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> panels <span class="token operator">=</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">TabPanel</span></span> <span class="token attr-name">key</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span> <span class="token attr-name">tab</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项一<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">}</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span> <span class="token attr-name">disabled</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>选项一的内容<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">TabPanel</span></span><span class="token punctuation">></span></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">TabPanel</span></span> <span class="token attr-name">key</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>2<span class="token punctuation">"</span></span> <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>选项二<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>2<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>选项二的内容<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">TabPanel</span></span><span class="token punctuation">></span></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">TabPanel</span></span> <span class="token attr-name">key</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>3<span class="token punctuation">"</span></span> <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>选项三<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>3<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>选项三的内容<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">TabPanel</span></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 keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-demo<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">Tabs</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</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>normal<span class="token punctuation">"</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</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">Tabs</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</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>card<span class="token punctuation">"</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Tabs</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</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>button<span class="token punctuation">"</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><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><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},f.a.createElement(P)),f.a.createElement(A,{title:"额外内容",id:"Demonavextracontent",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tabs</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> <span class="token maybe-class-name">TabPanel</span> <span class="token operator">=</span> <span class="token maybe-class-name">Tabs</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">TabPanel</span></span><span class="token punctuation">;</span>\n<span class="token keyword">let</span> uniqId <span class="token operator">=</span> <span class="token number">4</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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token operator">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n panels<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项<span class="token number">1</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n id<span class="token operator">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token operator">:</span> <span class="token string">\'选项1的内容\'</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项<span class="token number">2</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n id<span class="token operator">:</span> <span class="token string">\'2\'</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>div</span><span class="token punctuation">></span></span>选项<span class="token number">2</span>的内容<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token parameter">id</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 activeId<span class="token operator">:</span> id<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">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <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> panels<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">p</span> <span class="token arrow operator">=></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">TabPanel</span></span> <span class="token spread"><span class="token punctuation">{</span><span class="token punctuation">...</span><span class="token attr-value">p</span><span class="token punctuation">}</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>p<span class="token punctuation">.</span><span class="token property-access">id</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>p<span class="token punctuation">.</span><span class="token property-access">content</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">TabPanel</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-demo<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">Tabs</span></span>\n <span class="token attr-name">activeId</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">activeId</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 method function property-access">onTabChange</span><span class="token punctuation">.</span><span class="token method function property-access">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">navExtraContent</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">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> whiteSpace<span class="token operator">:</span> <span class="token string">\'nowrap\'</span> <span class="token punctuation">}</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">当前网店:文三路网店</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</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">Tabs</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><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><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},f.a.createElement(j)),f.a.createElement(A,{title:"动态增删",id:"Demoaddanddel",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tabs</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> <span class="token maybe-class-name">TabPanel</span> <span class="token operator">=</span> <span class="token maybe-class-name">Tabs</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">TabPanel</span></span><span class="token punctuation">;</span>\n<span class="token keyword">let</span> uniqId <span class="token operator">=</span> <span class="token number">4</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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token operator">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n panels<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项<span class="token number">1</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n id<span class="token operator">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token operator">:</span> <span class="token string">\'选项1的内容\'</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项<span class="token number">2</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n id<span class="token operator">:</span> <span class="token string">\'2\'</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>div</span><span class="token punctuation">></span></span>选项<span class="token number">2</span>的内容<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onTabAdd</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <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 panels<span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">选项</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>uniqId<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></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>uniqId<span class="token operator">++</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>\n content<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>\n <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 panels<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">onTabDel</span> <span class="token operator">=</span> <span class="token parameter">id</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> panels <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">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 panels<span class="token operator">:</span> panels<span class="token punctuation">.</span><span class="token method function property-access">filter</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">p<span class="token punctuation">,</span> i</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> p<span class="token punctuation">.</span><span class="token property-access">id</span> <span class="token operator">!==</span> id<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>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token parameter">id</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 activeId<span class="token operator">:</span> id<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">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <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> panels<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">p</span> <span class="token arrow operator">=></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">TabPanel</span></span> <span class="token spread"><span class="token punctuation">{</span><span class="token punctuation">...</span><span class="token attr-value">p</span><span class="token punctuation">}</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>p<span class="token punctuation">.</span><span class="token property-access">id</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>p<span class="token punctuation">.</span><span class="token property-access">content</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">TabPanel</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><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> panels <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-demo<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">Tabs</span></span>\n <span class="token attr-name">candel</span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">onDelete</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">onTabDel</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">navExtraContent</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-add-btn<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onTabAdd</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</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">Tabs</span></span>\n <span class="token attr-name">candel</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>card<span class="token punctuation">"</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">onDelete</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">onTabDel</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">navExtraContent</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-add-btn<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onTabAdd</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">style</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>\n marginTop<span class="token operator">:</span> <span class="token number">16</span>\n <span class="token punctuation">}</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>candel 属性只有在 normal 和 card 两种模式下起效<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><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><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},f.a.createElement(q)),f.a.createElement(A,{title:"内容伸展",id:"Demostretch",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Tabs</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> <span class="token maybe-class-name">TabPanel</span> <span class="token operator">=</span> <span class="token maybe-class-name">Tabs</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">TabPanel</span></span><span class="token punctuation">;</span>\n<span class="token keyword">let</span> uniqId <span class="token operator">=</span> <span class="token number">4</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 state <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token operator">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n panels<span class="token operator">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项<span class="token number">1</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n id<span class="token operator">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token operator">:</span> <span class="token string">\'选项1的内容\'</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项<span class="token number">2</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n id<span class="token operator">:</span> <span class="token string">\'2\'</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>div</span><span class="token punctuation">></span></span>选项<span class="token number">2</span>的内容<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onTabAdd</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <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 panels<span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n tab<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">选项</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>uniqId<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></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>uniqId<span class="token operator">++</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>\n content<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>\n <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 panels<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">onTabDel</span> <span class="token operator">=</span> <span class="token parameter">id</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> panels <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">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 panels<span class="token operator">:</span> panels<span class="token punctuation">.</span><span class="token method function property-access">filter</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">p<span class="token punctuation">,</span> i</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> p<span class="token punctuation">.</span><span class="token property-access">id</span> <span class="token operator">!==</span> id<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>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token parameter">id</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 activeId<span class="token operator">:</span> id<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">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <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> panels<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span><span class="token parameter">p</span> <span class="token arrow operator">=></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">TabPanel</span></span> <span class="token spread"><span class="token punctuation">{</span><span class="token punctuation">...</span><span class="token attr-value">p</span><span class="token punctuation">}</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>p<span class="token punctuation">.</span><span class="token property-access">id</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>p<span class="token punctuation">.</span><span class="token property-access">content</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">TabPanel</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><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> panels <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-demo<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">Tabs</span></span>\n <span class="token attr-name">candel</span>\n <span class="token attr-name">stretch</span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">onDelete</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">onTabDel</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">navExtraContent</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-add-btn<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onTabAdd</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</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">Tabs</span></span>\n <span class="token attr-name">candel</span>\n <span class="token attr-name">stretch</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>card<span class="token punctuation">"</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">onDelete</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">onTabDel</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">navExtraContent</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-add-btn<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onTabAdd</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</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">Tabs</span></span>\n <span class="token attr-name">stretch</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>button<span class="token punctuation">"</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">navExtraContent</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-add-btn<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onTabAdd</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span>panels<span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Tabs</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><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><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},f.a.createElement(D)),f.a.createElement(A,{title:"竖直模式",id:"Demovertical",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">VerticalTabs</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 punctuation">{</span> <span class="token maybe-class-name">TabPanel</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Divide</span> <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token maybe-class-name">VerticalTabs</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">Component</span> <span class="token punctuation">{</span>\n <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">props</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">super</span><span class="token punctuation">(</span>props<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 property-access">state</span> <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token operator">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token parameter">id</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 activeId<span class="token operator">:</span> id<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">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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-tabs-demo<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">VerticalTabs</span></span>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</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><span class="token class-name">TabPanel</span></span> <span class="token attr-name">tab</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>选项<span class="token number">1</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">}</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span> <span class="token attr-name">disabled</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>选项一的内容<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">TabPanel</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">TabPanel</span></span> <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>选项2<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>2<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>选项二的内容<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">TabPanel</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">Divide</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">TabPanel</span></span> <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>选项3<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>3<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>选项三的内容<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">TabPanel</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">VerticalTabs</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">VerticalTabs</span></span>\n <span class="token attr-name">tabs</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 punctuation">{</span>\n title<span class="token operator">:</span> <span class="token string">\'选项1\'</span><span class="token punctuation">,</span>\n key<span class="token operator">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<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 punctuation">,</span>\n <span class="token punctuation">{</span>\n title<span class="token operator">:</span> <span class="token string">\'选项2\'</span><span class="token punctuation">,</span>\n key<span class="token operator">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span>\n divide<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 punctuation">,</span>\n <span class="token punctuation">{</span>\n title<span class="token operator">:</span> <span class="token string">\'选项3\'</span><span class="token punctuation">,</span>\n key<span class="token operator">:</span> <span class="token string">\'3\'</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>\n <span class="token attr-name">activeId</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">activeId</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">onTabChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">scrollHeight</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">100</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>竖直模式下,无法使用内部的删除、对齐、伸展、额外内容等功能<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><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><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},f.a.createElement(z)),f.a.createElement(S,{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="#tabs">¶</a><a href="javascript:void(0)" id="tabs" class="anchor-point"></a>Tabs</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<th>是否必须</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>activeId</td>\n<td>激活的 tab-id</td>\n<td>string \n|\n number</td>\n<td></td>\n<td></td>\n<td>是</td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>选中的 tab 改变时</td>\n<td>(id: string \n|\n number) => any</td>\n<td></td>\n<td></td>\n<td>是</td>\n</tr>\n<tr>\n<td>tabs</td>\n<td>不使用 Panel 时的标签列表</td>\n<td>Array<ITab\n></td>\n<td></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<td>否</td>\n</tr>\n<tr>\n<td>type</td>\n<td>tabs 组件类型</td>\n<td>string</td>\n<td><code>\'normal\'</code></td>\n<td><code>\'card\'</code>\n, \n<code>\'button\'</code></td>\n<td>否</td>\n</tr>\n<tr>\n<td>navExtraContent</td>\n<td>导航添加额外内容</td>\n<td>React.ReactNode</td>\n<td></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>stretch</td>\n<td>tab 是否撑满全部空间</td>\n<td>boolean</td>\n<td><code>false</code></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>onDelete</td>\n<td>关闭 tab 时</td>\n<td>(id: string \n|\n number) => any</td>\n<td></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>candel</td>\n<td>是否可删除</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>unmountPanelOnHide</td>\n<td>panel 非 active 时,不使用 \n<code>display: none</code>\n 隐藏而是直接 unmount 组件</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n<td>no</td>\n</tr>\n</tbody>\n</table>\n<p>tabs 参数类型:</p>\n<pre><code class="language-ts"><span class="token keyword">interface</span> <span class="token class-name">ITab</span> <span class="token punctuation">{</span>\n key<span class="token operator">:</span> <span class="token builtin">string</span> <span class="token operator">|</span> <span class="token builtin">number</span><span class="token punctuation">;</span> <span class="token comment">// 同TabPanel id</span>\n title<span class="token operator">:</span> ReactNode<span class="token punctuation">;</span> <span class="token comment">// 同TabPanel tab</span>\n disabled<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">boolean</span><span class="token punctuation">;</span> <span class="token comment">// 同TabPanel disabled</span>\n<span class="token punctuation">}</span></code></pre>\n<h4 class="anchor-heading"><a href="#verticaltabs">¶</a><a href="javascript:void(0)" id="verticaltabs" class="anchor-point"></a>VerticalTabs</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<th>是否必须</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>activeId</td>\n<td>激活的 tab-id</td>\n<td>string \n|\n number</td>\n<td></td>\n<td></td>\n<td>是</td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>选中的 tab 改变时</td>\n<td>(id: string \n|\n number) => any</td>\n<td></td>\n<td></td>\n<td>是</td>\n</tr>\n<tr>\n<td>tabs</td>\n<td>不使用 Panel 时的标签列表</td>\n<td>Array<IVerticalTab\n></td>\n<td></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<td>否</td>\n</tr>\n<tr>\n<td>scrollHeight</td>\n<td>可滚动区域的最大高度</td>\n<td>string \n|\n number</td>\n<td></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>unmountPanelOnHide</td>\n<td>panel 非 active 时,不使用 \n<code>display: none</code>\n 隐藏而是直接 unmount 组件</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n<td>no</td>\n</tr>\n</tbody>\n</table>\n<p>tabs 参数类型:</p>\n<pre><code class="language-ts"><span class="token keyword">type</span> <span class="token class-name">IVerticalTab</span> <span class="token operator">=</span> ITab <span class="token operator">|</span> <span class="token punctuation">{</span> divide<span class="token operator">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">;</span></code></pre>\n<h4 class="anchor-heading"><a href="#tabpanel">¶</a><a href="javascript:void(0)" id="tabpanel" class="anchor-point"></a>TabPanel</h4>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>是否必须</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>tab</td>\n<td>该 TabPanel 所对应的 tab 标签的名字</td>\n<td>ReactNode</td>\n<td>是</td>\n</tr>\n<tr>\n<td>id</td>\n<td>该 TabPanel 的 id</td>\n<td>string \n|\n number</td>\n<td>是</td>\n</tr>\n<tr>\n<td>disabled</td>\n<td>该 TabPanel 是否被禁用</td>\n<td>bool</td>\n<td>否</td>\n</tr>\n<tr>\n<td>className</td>\n<td>该 TabPanel 上添加的额外 className</td>\n<td>bool</td>\n<td>否</td>\n</tr>\n<tr>\n<td>unmountOnHide</td>\n<td>非 active 时,不使用 \n<code>display: none</code>\n 隐藏而是直接 unmount 组件</td>\n<td>bool</td>\n<td>否</td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#divide">¶</a><a href="javascript:void(0)" id="divide" class="anchor-point"></a>Divide</h4>\n<p>用于表示 VerticalTabs 的分割线,不需要传递 props</p>'}))}}]),s}(v.Component)}}]);