-
Notifications
You must be signed in to change notification settings - Fork 0
/
17-a28f22da2d828c0b81f9.js
1 lines (1 loc) · 70.1 KB
/
17-a28f22da2d828c0b81f9.js
1
webpackJsonp([17],{1540:function(n,a,s){"use strict";function t(n){return n&&n.__esModule?n:{default:n}}function p(n){return v.default.createElement(n.tag,(0,l.default)({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function o(n){return v.default.createElement(p,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function e(n){return v.default.createElement(p,{tag:"style",html:n.style})}function c(n,a){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(a+=n.offsetTop),c(n.parentNode,a);return a}Object.defineProperty(a,"__esModule",{value:!0});var u=s(7),l=t(u),k=s(1),i=t(k),r=s(4),d=t(r),g=s(2),f=t(g),b=s(3),m=t(b),h=s(0),v=t(h),y=s(232),T=t(y),w=s(359),E=function(){var n=w.Tabs.TabPanel,a=function(a){function s(){var n,a,t,p;(0,i.default)(this,s);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return a=t=(0,f.default)(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(e))),t.state={activeId:"2"},t.onTabChange=function(n){t.setState({activeId:n})},p=a,(0,f.default)(t,p)}return(0,m.default)(s,a),(0,d.default)(s,[{key:"render",value:function(){return v.default.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange},v.default.createElement(n,{tab:v.default.createElement("span",null,"选项一"),id:"1",disabled:!0},v.default.createElement("div",null,"选项一的内容")),v.default.createElement(n,{tab:"选项二",id:"2"},v.default.createElement("div",null,"选项二的内容")),v.default.createElement(n,{tab:"选项三",id:"3"},v.default.createElement("div",null,"选项三的内容")))}}]),s}(v.default.Component);return v.default.createElement(a,null)},P=function(){var n=w.Tabs.TabPanel,a=function(a){function s(){var n,a,t,p;(0,i.default)(this,s);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return a=t=(0,f.default)(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(e))),t.state={activeId:"2"},t.onTabChange=function(n){t.setState({activeId:n})},p=a,(0,f.default)(t,p)}return(0,m.default)(s,a),(0,d.default)(s,[{key:"render",value:function(){return v.default.createElement(w.Tabs,{type:"slider",activeId:this.state.activeId,onChange:this.onTabChange},v.default.createElement(n,{tab:v.default.createElement("span",null,"选项一"),id:"1",disabled:!0},v.default.createElement("div",null,"选项一的内容")),v.default.createElement(n,{tab:"选项二",id:"2"},v.default.createElement("div",null,"选项二的内容")),v.default.createElement(n,{tab:"选项三",id:"3"},v.default.createElement("div",null,"选项三的内容")))}}]),s}(v.default.Component);return v.default.createElement(a,null)},C=function(){var n=w.Tabs.TabPanel,a=function(a){function s(){var n,a,t,p;(0,i.default)(this,s);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return a=t=(0,f.default)(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(e))),t.state={activeId:"2"},t.onTabChange=function(n){t.setState({activeId:n})},p=a,(0,f.default)(t,p)}return(0,m.default)(s,a),(0,d.default)(s,[{key:"render",value:function(){return v.default.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange,type:"card"},v.default.createElement(n,{tab:v.default.createElement("span",null,"选项一"),id:"1",disabled:!0},v.default.createElement("div",null,"选项一的内容")),v.default.createElement(n,{tab:"选项二",id:"2"},v.default.createElement("div",null,"选项二的内容")),v.default.createElement(n,{tab:"选项三",id:"3"},v.default.createElement("div",null,"选项三的内容")))}}]),s}(v.default.Component);return v.default.createElement(a,null)},I=function(){var n=w.Tabs.TabPanel,a=4,s=function(s){function t(){var n,s,p,o;(0,i.default)(this,t);for(var e=arguments.length,c=Array(e),u=0;u<e;u++)c[u]=arguments[u];return s=p=(0,f.default)(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(c))),p.state={activeId:"2",panels:[{tab:v.default.createElement("span",null,"选项1"),id:"1",disabled:!0,content:"选项1的内容"},{tab:v.default.createElement("span",null,"选项2"),id:"2",content:v.default.createElement("div",null,"选项2的内容")}]},p.onTabAdd=function(){var n=p.state.panels;n.push({tab:"选项"+a,id:""+a++,content:Date.now()}),p.setState({panels:n})},p.onTabDel=function(n){var a=p.state.panels,s=-1;a.some(function(a,t){return a.id===n&&(s=t,!0)}),s>-1&&(a.splice(s,1),p.setState({panels:a}))},p.onTabChange=function(n){p.setState({activeId:n})},o=s,(0,f.default)(p,o)}return(0,m.default)(t,s),(0,d.default)(t,[{key:"renderPanels",value:function(){return this.state.panels.map(function(a){return v.default.createElement(n,(0,l.default)({},a,{key:a.id}),a.content)})}},{key:"render",value:function(){return v.default.createElement(w.Tabs,{candel:!0,canadd:!0,activeId:this.state.activeId,onChange:this.onTabChange.bind(this),onDelete:this.onTabDel.bind(this),onAdd:this.onTabAdd.bind(this)},this.renderPanels())}}]),t}(v.default.Component);return v.default.createElement(s,null)},_=function(){var n=function(n){function a(n){(0,i.default)(this,a);var s=(0,f.default)(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,n));return s.state={activeId:"2",tabs:[{title:"选项一",key:"1",disabled:!0},{title:"选项二",key:"2"},{title:"选项三",key:"3"}]},s}return(0,m.default)(a,n),(0,d.default)(a,[{key:"onTabChange",value:function(n){this.setState({activeId:n})}},{key:"render",value:function(){return v.default.createElement("div",null,v.default.createElement("div",{style:{marginTop:"10px"}},v.default.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange.bind(this),tabs:this.state.tabs}),v.default.createElement("h1",null,this.state.activeId)))}}]),a}(h.Component);return v.default.createElement(n,null)},S=function(){var n=w.Tabs.TabPanel,a=4,s=function(s){function t(){var n,s,p,o;(0,i.default)(this,t);for(var e=arguments.length,c=Array(e),u=0;u<e;u++)c[u]=arguments[u];return s=p=(0,f.default)(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(c))),p.state={activeId:"2",panels:[{tab:v.default.createElement("span",null,"选项1"),id:"1",disabled:!0,content:"选项1的内容"},{tab:v.default.createElement("span",null,"选项2"),id:"2",content:v.default.createElement("div",null,"选项2的内容")}]},p.onTabAdd=function(){var n=p.state.panels;n.push({tab:"选项"+a,id:""+a++,content:Date.now()}),p.setState({panels:n})},p.onTabDel=function(n){var a=p.state.panels,s=-1;a.some(function(a,t){return a.id===n&&(s=t,!0)}),s>-1&&(a.splice(s,1),p.setState({panels:a}))},p.onTabChange=function(n){p.setState({activeId:n})},o=s,(0,f.default)(p,o)}return(0,m.default)(t,s),(0,d.default)(t,[{key:"renderPanels",value:function(){return this.state.panels.map(function(a){return v.default.createElement(n,(0,l.default)({},a,{key:a.id}),a.content)})}},{key:"render",value:function(){return v.default.createElement(w.Tabs,{candel:!0,canadd:!0,activeId:this.state.activeId,onChange:this.onTabChange.bind(this),onDelete:this.onTabDel.bind(this),onAdd:this.onTabAdd.bind(this),navExtraContent:v.default.createElement("span",{style:{lineHeight:"35px",padding:"0 5px"}},"当前网店:文三路网店")},this.renderPanels())}}]),t}(v.default.Component);return v.default.createElement(s,null)},j=function(n){function a(){var n,s,t,p;(0,i.default)(this,a);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return s=t=(0,f.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(e))),t.state={showCode:!1},t.toggle=function(){t.setState({showCode:!t.state.showCode})},p=s,(0,f.default)(t,p)}return(0,m.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,o=a.children;return v.default.createElement("div",{className:"zandoc-react-demo"},v.default.createElement("div",{className:"zandoc-react-demo__preview"},o),v.default.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},v.default.createElement("div",{className:"zandoc-react-demo__title"},v.default.createElement("p",null,s||"")),v.default.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle "+(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&v.default.createElement("pre",{className:"zandoc-react-demo__code"},v.default.createElement(p,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),a}(h.Component),x=function(n){function a(){return(0,i.default)(this,a),(0,f.default)(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return(0,m.default)(a,n),(0,d.default)(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'+n+'"]');a&&(0,T.default)(document.documentElement,0,c(a,-9))}}},{key:"render",value:function(){return v.default.createElement("div",{className:"zandoc-react-container",key:null},v.default.createElement(e,{style:""}),v.default.createElement(o,{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>'}),v.default.createElement(j,{title:"基础用法",id:"Demobasic",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<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 punctuation">:</span> <span class="token string">\'2\'</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 punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\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>Tabs</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<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>TabPanel</span>\n <span class="token attr-name">tab={<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>\n id<span class="token operator">=</span><span class="token string">"1"</span>\n disabled\n <span class="token operator">></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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>选项二<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>选项三<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">\'</span>3<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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},v.default.createElement(E)),v.default.createElement(j,{title:"基础用法 slider",id:"Demoslider",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<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 punctuation">:</span> <span class="token string">\'2\'</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 punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\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>Tabs</span>\n <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>slider<span class="token punctuation">"</span></span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<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>TabPanel</span>\n <span class="token attr-name">tab={<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>\n id<span class="token operator">=</span><span class="token string">"1"</span>\n disabled\n <span class="token operator">></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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>选项二<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>选项三<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">\'</span>3<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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},v.default.createElement(P)),v.default.createElement(j,{title:"基础用法 card",id:"Democard",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<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 punctuation">:</span> <span class="token string">\'2\'</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 punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\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>Tabs</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>card<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>TabPanel</span>\n <span class="token attr-name">tab={<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>\n id<span class="token operator">=</span><span class="token string">"1"</span>\n disabled\n <span class="token operator">></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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>选项二<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>选项三<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">\'</span>3<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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},v.default.createElement(C)),v.default.createElement(j,{title:"加减用法",id:"Demoaddanddel",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<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 punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n panels<span class="token punctuation">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n tab<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>\n id<span class="token punctuation">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'选项1的内容\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n tab<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">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 punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>选项<span class="token number">2</span>的内容<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <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 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>state<span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n tab<span class="token punctuation">:</span> <span class="token template-string"><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 string">`</span></span><span class="token punctuation">,</span>\n id<span class="token punctuation">:</span> <span class="token template-string"><span class="token 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 string">`</span></span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> Date<span class="token punctuation">.</span><span class="token function">now</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 function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n onTabDel <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token 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>state<span class="token punctuation">;</span>\n <span class="token keyword">let</span> index <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">some</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">,</span> i<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>p<span class="token punctuation">.</span>id <span class="token operator">===</span> id<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n index <span class="token operator">=</span> i<span class="token punctuation">;</span>\n <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token keyword">return</span> <span class="token boolean">false</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">if</span> <span class="token punctuation">(</span>index <span class="token operator">></span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n panels<span class="token punctuation">.</span><span class="token function">splice</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\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">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>state<span class="token punctuation">;</span>\n <span class="token keyword">return</span> panels<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</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 punctuation">=</span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>id<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>content<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>TabPanel</span><span class="token punctuation">></span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">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>Tabs</span>\n <span class="token attr-name">candel</span>\n <span class="token attr-name">canadd</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">.</span><span class="token function">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">onDelete</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabDel<span class="token punctuation">.</span><span class="token function">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">onAdd</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabAdd<span class="token punctuation">.</span><span class="token function">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 punctuation">></span></span>\n <span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><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 tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},v.default.createElement(I)),v.default.createElement(j,{title:"不使用TabPanel,只使用Tab展示导航",id:"Demonotabpanel",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">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>props<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>state <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n tabs<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n title<span class="token punctuation">:</span> <span class="token string">\'选项一\'</span><span class="token punctuation">,</span>\n key<span class="token punctuation">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token punctuation">:</span> <span class="token boolean">true</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n title<span class="token punctuation">:</span> <span class="token string">\'选项二\'</span><span class="token punctuation">,</span>\n key<span class="token punctuation">:</span> <span class="token string">\'2\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n title<span class="token punctuation">:</span> <span class="token string">\'选项三\'</span><span class="token punctuation">,</span>\n key<span class="token punctuation">:</span> <span class="token string">\'3\'</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">onTabChange</span><span class="token punctuation">(</span>id<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 function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\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 punctuation">></span></span>\n <span class="token operator"><</span>div style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> marginTop<span class="token punctuation">:</span> <span class="token string">\'10px\'</span> <span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tabs</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">.</span><span class="token function">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">tabs</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>tabs<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>h1</span><span class="token punctuation">></span></span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h1</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\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},v.default.createElement(_)),v.default.createElement(j,{title:"导航添加额外内容",id:"Demonavextracontent",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<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 punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n panels<span class="token punctuation">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n tab<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>\n id<span class="token punctuation">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'选项1的内容\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n tab<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">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 punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>选项<span class="token number">2</span>的内容<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <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 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>state<span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n tab<span class="token punctuation">:</span> <span class="token template-string"><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 string">`</span></span><span class="token punctuation">,</span>\n id<span class="token punctuation">:</span> <span class="token template-string"><span class="token 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 string">`</span></span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> Date<span class="token punctuation">.</span><span class="token function">now</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 function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n onTabDel <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token 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>state<span class="token punctuation">;</span>\n <span class="token keyword">let</span> index <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">some</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">,</span> i<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>p<span class="token punctuation">.</span>id <span class="token operator">===</span> id<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n index <span class="token operator">=</span> i<span class="token punctuation">;</span>\n <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token keyword">return</span> <span class="token boolean">false</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">if</span> <span class="token punctuation">(</span>index <span class="token operator">></span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n panels<span class="token punctuation">.</span><span class="token function">splice</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\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">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>state<span class="token punctuation">;</span>\n <span class="token keyword">return</span> panels<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</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 punctuation">=</span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>id<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>content<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>TabPanel</span><span class="token punctuation">></span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">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 operator"><</span>Tabs\n candel\n canadd\n activeId<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span>\n onChange<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n onDelete<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabDel<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n onAdd<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabAdd<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n navExtraContent<span class="token operator">=</span><span class="token punctuation">{</span><span class="token operator"><</span>span style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>lineHeight<span class="token punctuation">:</span> <span class="token string">"35px"</span><span class="token punctuation">,</span> padding<span class="token punctuation">:</span> <span class="token string">"0 5px"</span><span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span><span class="token punctuation">{</span><span class="token template-string"><span class="token string">`当前网店:文三路网店`</span></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 punctuation">}</span>\n <span class="token operator">></span>\n <span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><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 tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},v.default.createElement(S)),v.default.createElement(o,{html:'<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\n<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>type</td>\n<td>tabs组件类型</td>\n<td>string</td>\n<td><code>\'normal\'</code></td>\n<td><code>\'card\'</code>\n, \n<code>\'slider\'</code></td>\n<td>否</td>\n</tr>\n<tr>\n<td>size</td>\n<td>tabs的尺寸类型</td>\n<td>string</td>\n<td><code>\'normal\'</code></td>\n<td><code>\'huge\'</code></td>\n<td>否</td>\n</tr>\n<tr>\n<td>align</td>\n<td>tabs的布局类型</td>\n<td>string</td>\n<td><code>\'left\'</code></td>\n<td><code>\'right\'</code>\n, \n<code>\'center\'</code></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>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>onAdd</td>\n<td>点击增加tab时</td>\n<td>func</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>canadd</td>\n<td>是否可增加tab</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>tabs</td>\n<td>不使用Panel时的标签列表</td>\n<td>Array</td>\n<td><code>null</code></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>className</td>\n<td>自定义额外类名</td>\n<td>string</td>\n<td><code>\'\'</code></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>prefix</td>\n<td>自定义前缀</td>\n<td>string</td>\n<td><code>\'zent\'</code></td>\n<td></td>\n<td>否</td>\n</tr>\n<tr>\n<td>navExtraContent</td>\n<td>导航添加额外内容</td>\n<td>node</td>\n<td>null</td>\n<td></td>\n<td>否</td>\n</tr>\n</tbody>\n</table>\n<p>tabs参数类型:</p>\n<pre><code class="language-ts"><span class="token keyword">Array</span><span class="token operator"><</span><span class="token punctuation">{</span>\n key<span class="token punctuation">:</span> <span class="token keyword">string</span> <span class="token operator">|</span> <span class="token keyword">number</span><span class="token punctuation">,</span> <span class="token comment">// 同TabPanel id</span>\n title<span class="token punctuation">:</span> <span class="token keyword">string</span> <span class="token operator">|</span> <span class="token keyword">number</span><span class="token punctuation">,</span> <span class="token comment">// 同TabPanel tab</span>\n disabled<span class="token operator">?</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span> <span class="token comment">// 同TabPanel disabled</span>\n<span class="token punctuation">}</span><span class="token operator">></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>string</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</tbody>\n</table>'}))}}]),a}(h.Component);a.default=x}});