-
Notifications
You must be signed in to change notification settings - Fork 1
/
2469-b03711a4106623145fa3.js
1 lines (1 loc) · 50 KB
/
2469-b03711a4106623145fa3.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[2469],{12469:(n,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>O});var t=s(73450),p=s(73118),e=s(27378),o=s(57318),c=s(82010),l=s(50993),u=s(11497),i=s(3454),k=s(83931),r=s(68715),d=s(24246);function m(n,a){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.push.apply(s,t)}return s}function g(n){for(var a=1;a<arguments.length;a++){var s=null!=arguments[a]?arguments[a]:{};a%2?m(Object(s),!0).forEach((function(a){(0,t.Z)(n,a,s[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):m(Object(s)).forEach((function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))}))}return n}var h=function(){return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsxs)(c.b,{children:[(0,d.jsx)("span",{children:"通知提示文案"}),(0,d.jsx)("a",{href:"javascript:;",className:"zent-alert-demo-text",children:"文字链接"})]}),(0,d.jsx)(c.b,{title:"基础用法",description:"通知提示文案"})]})},f=function(){return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsx)(c.b,{type:"info",children:"这个是默认的 info 样式"}),(0,d.jsx)(c.b,{type:"success",children:"这个是 success 样式"}),(0,d.jsx)(c.b,{type:"warning",children:"这个是 warning 样式"}),(0,d.jsx)(c.b,{type:"error",children:"这个是 error 样式"}),(0,d.jsx)(c.b,{type:"hint",children:"这个是 hint 样式"})]})},y=function(){return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsx)(c.b,{type:"info",loading:!0,children:"消息加载中..."}),(0,d.jsx)(l.c,{children:(0,d.jsx)(c.b,{type:"info",loading:!0,progress:40,children:"消息加载中..."})})]})},b=function(){var n=c.b.highlightClassName;return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsxs)(c.b,{type:"info",loading:!0,children:["内容正在处理 (",(0,d.jsx)("span",{className:n,children:"13/25"}),")"]}),(0,d.jsx)("p",{children:"使用 Alert.highlightClassName 来添加对应的高亮颜色"})]})},v=function(){var n=()=>{var n=e.useState(!1),a=(0,p.Z)(n,2),s=a[0],t=a[1];return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsx)(c.b,{closable:!0,closeContent:(0,d.jsx)("a",{href:"javascript:;",children:"我知道了"}),children:"关闭触发器可自定义"}),(0,d.jsx)(c.b,{closable:!0,closed:s,onClose:()=>{t(!0),u.Hj.alert({content:"公告关闭了"})},children:"关闭状态受控"}),(0,d.jsx)(i.z,{onClick:()=>t(!1),children:"重新显示"})]})};return(0,d.jsx)(n,{})},j=function(){return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsx)(c.b,{type:"info",extraContent:(0,d.jsx)(i.z,{type:"primary",children:"按钮"}),children:"额外内容会放置在 Alert 组件右侧"}),(0,d.jsx)(c.b,{type:"info",extraContent:(0,d.jsx)("a",{href:"javascript:;",children:"文字链接"}),children:"额外内容会放置在 Alert 组件右侧"})]})},x=function(){return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsx)(c.b,{type:"info",outline:!0,title:"Outline 模式",description:"outline 模式公告内容"}),(0,d.jsx)(c.b,{type:"success",outline:!0,title:"Outline 模式",description:"outline 模式公告内容"}),(0,d.jsx)(c.b,{type:"warning",outline:!0,title:"Outline 模式",description:"outline 模式公告内容"}),(0,d.jsx)(c.b,{type:"error",outline:!0,title:"Outline 模式",description:"outline 模式公告内容"})]})},A=function(){return(0,d.jsxs)("div",{className:"zent-alert-example",children:[(0,d.jsxs)(k.f,{children:[(0,d.jsx)(r.C,{closable:!0,children:"滚动提示文案111"}),(0,d.jsx)(r.C,{closable:!0,children:"滚动提示文案222"}),(0,d.jsx)(r.C,{closable:!0,children:"滚动提示文案333"})]}),(0,d.jsxs)(k.f,{children:[(0,d.jsx)(r.C,{title:"滚动提示111",description:"滚动提示文案111"}),(0,d.jsx)(r.C,{title:"滚动提示222",description:"滚动提示文案222"}),(0,d.jsx)(r.C,{title:"滚动提示333",description:"滚动提示文案333"})]})]})};function z(n){return(0,d.jsx)(n.tag,g(g({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function w(n){return(0,d.jsx)(z,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function N(n){return(0,d.jsx)(z,{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}class q extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{showCode:!1}),(0,t.Z)(this,"toggle",(()=>{this.setState({showCode:!this.state.showCode})}))}render(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,p=a.children;return(0,d.jsxs)("div",{className:"zandoc-react-demo",children:[(0,d.jsx)("div",{className:"zandoc-react-demo__preview",children:p}),(0,d.jsxs)("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle,children:[(0,d.jsx)("div",{className:"zandoc-react-demo__title",children:(0,d.jsx)("p",{children:s||""})}),(0,d.jsx)("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})]}),n&&(0,d.jsx)("pre",{className:"zandoc-react-demo__code",children:(0,d.jsx)(z,{tag:"code",html:t,attributes:{className:"language-jsx"}})})]})}}class O extends e.Component{componentDidMount(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&(0,o.l)(document.documentElement,0,C(a,-9))}}render(){return e.createElement("div",{className:"zandoc-react-container"},e.createElement(N,{style:".zent-alert-demo-text {\n\tmargin-left: 8px;\n}\n\n.zent-alert-example .zent-alert {\n\tmargin-bottom: 16px;\n}\n\n.zent-alert-example .zent-alert-scroll {\n\tmargin-bottom: 16px;\n}"}),e.createElement(w,{html:'<h2 class="anchor-heading"><a href="#alert-gong-gao">¶</a><a href="javascript:void(0)" id="alert-gong-gao" class="anchor-point"></a>Alert 公告</h2>\n<h4 class="anchor-heading"><a href="#alert-zu-jian-shi-prompt-banner-status">¶</a><a href="javascript:void(0)" id="alert-zu-jian-shi-prompt-banner-status" class="anchor-point"></a><strong>Alert 组件是 <code>Prompt</code>、<code>Banner</code>、<code>StatusBar</code>组件的基础组件,不建议直接使用</strong></h4>\n<p>公告,提供一个醒目的提示信息。</p>\n<h3 class="anchor-heading"><a href="#shi-yong-zhi-nan">¶</a><a href="javascript:void(0)" id="shi-yong-zhi-nan" class="anchor-point"></a>使用指南</h3>\n<ul>\n<li>内容文字尽可能精简, 减少阅读障碍。</li>\n<li>公告类按钮不要多于两个, 保持逻辑简单。</li>\n<li>滚动公告使用结构相同的子节点(高度一致)</li>\n</ul>\n<h3 class="anchor-heading"><a href="#dai-ma-yan-shi">¶</a><a href="javascript:void(0)" id="dai-ma-yan-shi" class="anchor-point"></a>代码演示</h3>'}),e.createElement(q,{title:"基础用法",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Alert</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">Alert</span></span><span class="token punctuation">></span></span>\n <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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>javascript:;<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-alert-demo-text<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n 文字链接\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</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">Alert</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">Alert</span></span> <span class="token attr-name">title</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">description</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 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 punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(h)),e.createElement(q,{title:"五种样式:info, success, warning, error 和 hint",id:"Demostyles",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Alert</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">Alert</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>info<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>这个是默认的 info 样式<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">Alert</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>success<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>这个是 success 样式<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">Alert</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>warning<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>这个是 warning 样式<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">Alert</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>error<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>这个是 error 样式<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">Alert</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>hint<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>这个是 hint 样式<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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 punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(f)),e.createElement(q,{title:"Loading 模式",id:"Demoloading",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Alert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">BlockLoading</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">Alert</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>info<span class="token punctuation">"</span></span> <span class="token attr-name">loading</span><span class="token punctuation">></span></span>\n 消息加载中<span class="token spread operator">...</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">BlockLoading</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">Alert</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>info<span class="token punctuation">"</span></span> <span class="token attr-name">loading</span> <span class="token attr-name">progress</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">40</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n 消息加载中<span class="token spread operator">...</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">BlockLoading</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 punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(y)),e.createElement(q,{title:"高亮文字",id:"Demohighlight",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Alert</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">const</span> <span class="token punctuation">{</span> highlightClassName <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token maybe-class-name">Alert</span><span class="token punctuation">;</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">Alert</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>info<span class="token punctuation">"</span></span> <span class="token attr-name">loading</span><span class="token punctuation">></span></span>\n <span class="token function">内容正在处理</span> <span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">className</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>highlightClassName<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token number">13</span><span class="token operator">/</span><span class="token number">25</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 tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>使用 <span class="token maybe-class-name">Alert</span><span class="token punctuation">.</span><span class="token property-access">highlightClassName</span> 来添加对应的高亮颜色<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</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 punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(b)),e.createElement(q,{title:"关闭按钮及回调",id:"Democlose",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Alert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">ScrollAlert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">AlertItem</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">const</span> <span class="token function-variable function"><span class="token maybe-class-name">Simple</span></span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">[</span>closed<span class="token punctuation">,</span> setClosed<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">useState</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token keyword">const</span> <span class="token function-variable function">onCloseHandler</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 function">setClosed</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token literal-property property">content</span><span class="token operator">:</span> <span class="token string">\'公告关闭了\'</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>\n\n <span class="token keyword">const</span> <span class="token function-variable function">onScrollAlertClose</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 console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">\'all\'</span><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 keyword">const</span> <span class="token function-variable function">onScrollAlertItemClose</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 console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">\'item\'</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 keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">Alert</span></span>\n <span class="token attr-name">closable</span>\n <span class="token attr-name">closeContent</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>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>javascript:;<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>我知道了<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n 关闭触发器可自定义\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">Alert</span></span> <span class="token attr-name">closable</span> <span class="token attr-name">closed</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>closed<span class="token punctuation">}</span></span> <span class="token attr-name">onClose</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>onCloseHandler<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n 关闭状态受控\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">setClosed</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>重新显示<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Button</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n<span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span><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>'},e.createElement(v)),e.createElement(q,{title:"额外内容",id:"Demoextra",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Alert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">Alert</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>info<span class="token punctuation">"</span></span>\n <span class="token attr-name">extraContent</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">Button</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>按钮<span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Button</span></span><span class="token punctuation">></span></span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n 额外内容会放置在 <span class="token maybe-class-name">Alert</span> 组件右侧\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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">Alert</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>info<span class="token punctuation">"</span></span> <span class="token attr-name">extraContent</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>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>javascript:;<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>文字链接<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n 额外内容会放置在 <span class="token maybe-class-name">Alert</span> 组件右侧\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">Alert</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 punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(j)),e.createElement(q,{title:"Outline 模式",id:"Demooutline",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Alert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">Alert</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>info<span class="token punctuation">"</span></span>\n <span class="token attr-name">outline</span>\n <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Outline 模式<span class="token punctuation">"</span></span>\n <span class="token attr-name">description</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>outline 模式公告内容<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">Alert</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>success<span class="token punctuation">"</span></span>\n <span class="token attr-name">outline</span>\n <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Outline 模式<span class="token punctuation">"</span></span>\n <span class="token attr-name">description</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>outline 模式公告内容<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">Alert</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>warning<span class="token punctuation">"</span></span>\n <span class="token attr-name">outline</span>\n <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Outline 模式<span class="token punctuation">"</span></span>\n <span class="token attr-name">description</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>outline 模式公告内容<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">Alert</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>error<span class="token punctuation">"</span></span>\n <span class="token attr-name">outline</span>\n <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Outline 模式<span class="token punctuation">"</span></span>\n <span class="token attr-name">description</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>outline 模式公告内容<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 punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(x)),e.createElement(q,{title:"滚动提示",id:"Demoscroll",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">ScrollAlert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">AlertItem</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-alert-example<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">ScrollAlert</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">AlertItem</span></span> <span class="token attr-name">closable</span><span class="token punctuation">></span></span>滚动提示文案<span class="token number">111</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">AlertItem</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">AlertItem</span></span> <span class="token attr-name">closable</span><span class="token punctuation">></span></span>滚动提示文案<span class="token number">222</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">AlertItem</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">AlertItem</span></span> <span class="token attr-name">closable</span><span class="token punctuation">></span></span>滚动提示文案<span class="token number">333</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span><span class="token class-name">AlertItem</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">ScrollAlert</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">ScrollAlert</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">AlertItem</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>滚动提示111<span class="token punctuation">"</span></span> <span class="token attr-name">description</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>滚动提示文案111<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">AlertItem</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>滚动提示222<span class="token punctuation">"</span></span> <span class="token attr-name">description</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>滚动提示文案222<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">AlertItem</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>滚动提示333<span class="token punctuation">"</span></span> <span class="token attr-name">description</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>滚动提示文案333<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">ScrollAlert</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 punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(A)),e.createElement(w,{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="#alert">¶</a><a href="javascript:void(0)" id="alert" class="anchor-point"></a>Alert</h4>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>默认值</th>\n<th>备选值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>className</td>\n<td>自定义额外类名</td>\n<td>string</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>type</td>\n<td>警告提示的样式</td>\n<td>string</td>\n<td><code>\'info\'</code></td>\n<td><code>\'info\'</code>\n, \n<code>\'success\'</code>\n, \n<code>\'warning\'</code>\n, \n<code>\'error\'</code>\n, \n<code>\'hint\'</code></td>\n</tr>\n<tr>\n<td>loading</td>\n<td>是否是加载中模式</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>outline</td>\n<td>是否是 outline 模式</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>closable</td>\n<td>是否可以关闭</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>closed</td>\n<td>外部控制组件的关闭状态</td>\n<td>bool</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onClose</td>\n<td>点击关闭触发器时的回调</td>\n<td>func</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>closeContent</td>\n<td>关闭触发器的自定义内容</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>extraContent</td>\n<td>右侧额外内容</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>title</td>\n<td>内容标题</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>description</td>\n<td>内容描述</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>bordered</td>\n<td>是否有边框</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>icon</td>\n<td>自定义左侧 icon</td>\n<td>node</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>closeIconColor</td>\n<td>自定义 close 颜色</td>\n<td>string</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>progress</td>\n<td>顶部进度条进度</td>\n<td>number</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#scrollalert">¶</a><a href="javascript:void(0)" id="scrollalert" class="anchor-point"></a>ScrollAlert</h4>\n<h5 class="anchor-heading"><a href="#zhi-zhi-chi-deng-gao-de-zi-jie-dian-zan-bu-zhi-chi-dong-tai-xuan-ran-zi-jie-dian">¶</a><a href="javascript:void(0)" id="zhi-zhi-chi-deng-gao-de-zi-jie-dian-zan-bu-zhi-chi-dong-tai-xuan-ran-zi-jie-dian" class="anchor-point"></a>只支持等高的子节点, 暂不支持动态渲染子节点</h5>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>默认值</th>\n<th>备选值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>className</td>\n<td>自定义额外类名</td>\n<td>string</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>type</td>\n<td>警告提示的样式</td>\n<td>string</td>\n<td><code>\'info\'</code></td>\n<td><code>\'info\'</code>\n, \n<code>\'success\'</code>\n, \n<code>\'warning\'</code>\n, \n<code>\'error\'</code>\n, \n<code>\'hint\'</code></td>\n</tr>\n<tr>\n<td>scrollInterval</td>\n<td>自定义滚动间隔 (单位:毫秒)</td>\n<td>number</td>\n<td>5000</td>\n<td>大于 1000</td>\n</tr>\n<tr>\n<td>loading</td>\n<td>是否是加载中模式</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>outline</td>\n<td>是否是 outline 模式</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>onClose</td>\n<td>关闭所有节点时触发的回调</td>\n<td>func</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>closed</td>\n<td>外部控制整个组件的关闭状态</td>\n<td>bool</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#alertitem">¶</a><a href="javascript:void(0)" id="alertitem" class="anchor-point"></a>AlertItem</h4>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>默认值</th>\n<th>备选值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>closable</td>\n<td>是否可以关闭</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code>\n, \n<code>false</code></td>\n</tr>\n<tr>\n<td>closeContent</td>\n<td>关闭触发器的自定义内容</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>extraContent</td>\n<td>右侧额外内容</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>title</td>\n<td>内容标题</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>description</td>\n<td>内容描述</td>\n<td>ReactNode</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onClose</td>\n<td>关闭当前节点时触发的回调(closable 为 true)</td>\n<td>func</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>'}))}}}}]);