-
Notifications
You must be signed in to change notification settings - Fork 0
/
51-a28f22da2d828c0b81f9.js
1 lines (1 loc) · 73.7 KB
/
51-a28f22da2d828c0b81f9.js
1
webpackJsonp([51],{1580:function(n,a,s){"use strict";function t(n){return n&&n.__esModule?n:{default:n}}function p(n){return y.default.createElement(n.tag,(0,u.default)({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function o(n){return y.default.createElement(p,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function e(n){return y.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 l=s(7),u=t(l),i=s(1),k=t(i),r=s(4),d=t(r),g=s(2),m=t(g),f=s(3),h=t(f),v=s(0),y=t(v),P=s(232),w=t(P),B=s(359),b=function(){return y.default.createElement("div",{className:"zent-doc-pop-container"},y.default.createElement(B.Pop,{trigger:"hover",content:"鼠标移入触发方式"},y.default.createElement(B.Button,{type:"primary"},"移入鼠标")),y.default.createElement(B.Pop,{trigger:"click",content:"鼠标点击触发方式"},y.default.createElement(B.Button,{type:"primary"},"点击鼠标")),y.default.createElement(B.Pop,{trigger:"focus",content:"获得输入焦点触发方式"},y.default.createElement(B.Input,{defaultValue:"点击获取焦点"})))},E=function(){return y.default.createElement("div",{className:"zent-doc-pop-positions"},y.default.createElement("div",{className:"zent-doc-pop-positions-top-row"},y.default.createElement(B.Pop,{trigger:"hover",position:"top-left",content:"Top Left"},y.default.createElement(B.Button,null,"TopLeft")),y.default.createElement(B.Pop,{trigger:"hover",position:"top-center",content:"Top Center"},y.default.createElement(B.Button,null,"TopCenter")),y.default.createElement(B.Pop,{trigger:"hover",position:"top-right",content:"Top Right"},y.default.createElement(B.Button,null,"TopRight"))),y.default.createElement("div",{className:"zent-doc-pop-positions-bottom-row"},y.default.createElement(B.Pop,{trigger:"hover",position:"bottom-left",content:"Bottom Left"},y.default.createElement(B.Button,null,"BottomLeft")),y.default.createElement(B.Pop,{trigger:"hover",position:"bottom-center",content:"Bottom Center"},y.default.createElement(B.Button,null,"BottomCenter")),y.default.createElement(B.Pop,{trigger:"hover",position:"bottom-right",content:"Bottom Right"},y.default.createElement(B.Button,null,"BottomRight"))),y.default.createElement("div",{className:"zent-doc-pop-positions-left-col"},y.default.createElement(B.Pop,{trigger:"hover",position:"left-top",content:"Left Top"},y.default.createElement(B.Button,null,"LeftTop")),y.default.createElement(B.Pop,{trigger:"hover",position:"left-center",content:"Left Center"},y.default.createElement(B.Button,null,"LeftCenter")),y.default.createElement(B.Pop,{trigger:"hover",position:"left-bottom",content:"Left Bottom"},y.default.createElement(B.Button,null,"LeftBottom"))),y.default.createElement("div",{className:"zent-doc-pop-positions-right-col"},y.default.createElement(B.Pop,{trigger:"hover",position:"right-top",content:"Right Top"},y.default.createElement(B.Button,null,"RightTop")),y.default.createElement(B.Pop,{trigger:"hover",position:"right-center",content:"Right Center"},y.default.createElement(B.Button,null,"RightCenter")),y.default.createElement(B.Pop,{trigger:"hover",position:"right-bottom",content:"Right Bottom"},y.default.createElement(B.Button,null,"RightBottom"))))},C=function(){return y.default.createElement("div",{className:"zent-doc-pop-container"},y.default.createElement(B.Pop,{centerArrow:!0,trigger:"hover",position:"top-left",content:"centerArrow 为 true"},y.default.createElement("span",{className:"zent-doc-pop-tag"},"Y")),y.default.createElement(B.Pop,{trigger:"hover",position:"top-left",content:"centerArrow 为 false"},y.default.createElement("span",{className:"zent-doc-pop-tag"},"N")))},z=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return s=t=(0,m.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(e))),t.confirmHandler=function(){B.Sweetalert.alert({content:"Pop关闭了",parentComponent:t})},p=s,(0,m.default)(t,p)}return(0,h.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){return y.default.createElement(B.Pop,{trigger:"click",content:"提示内容",onConfirm:this.confirmHandler},y.default.createElement(B.Button,{type:"primary"},"打开气泡"))}}]),a}(y.default.Component);return y.default.createElement(n,null)},j=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return s=t=(0,m.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(e))),t.confirmHandler=function(){B.Sweetalert.alert({content:"Pop关闭了",parentComponent:t})},p=s,(0,m.default)(t,p)}return(0,h.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){return y.default.createElement(B.Pop,{trigger:"click",content:"提示内容",type:"danger",confirmText:"Error",cancelText:"Close",onConfirm:this.confirmHandler},y.default.createElement(B.Button,{type:"primary"},"打开气泡"))}}]),a}(y.default.Component);return y.default.createElement(n,null)},N=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return s=t=(0,m.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(e))),t.state={visible:!1},t.onBeforeShow=function(n){setTimeout(n,500)},t.onBeforeClose=function(){return new Promise(function(n){setTimeout(n,500)})},p=s,(0,m.default)(t,p)}return(0,h.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){return y.default.createElement(B.Pop,{content:"延迟500ms关闭",trigger:"click",onBeforeShow:this.onBeforeShow,onBeforeClose:this.onBeforeClose},y.default.createElement(B.Button,{type:"primary"},"延迟500ms打开"))}}]),a}(v.Component);return y.default.createElement(n,null)},_=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return s=t=(0,m.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(e))),t.state={visible:!1},t.close=function(){t.setState({visible:!1})},t.open=function(){t.setState({visible:!0})},p=s,(0,m.default)(t,p)}return(0,h.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){var n=y.default.createElement("div",null,y.default.createElement("p",{style:{marginBottom:10}},"可以在 Pop 内部关闭"),y.default.createElement(B.Button,{type:"primary",onClick:this.close},"关闭"));return y.default.createElement("div",{className:"zent-doc-pop-none-trigger-container"},y.default.createElement(B.Pop,{content:n,trigger:"none",visible:this.state.visible},y.default.createElement(B.Button,{type:"primary",onClick:this.open},"打开")),y.default.createElement(B.Button,{disabled:!this.state.visible,onClick:this.close},"外部关闭"))}}]),a}(v.Component);return y.default.createElement(n,null)},T=function(){var n=B.Pop.withPop(function(n){var a=n.pop;return y.default.createElement("div",null,y.default.createElement("div",null,"Pop 内容"),y.default.createElement(B.Button,{onClick:a.close},"关闭"))});return y.default.createElement(B.Pop,{trigger:"click",content:y.default.createElement(n,null)},y.default.createElement(B.Button,{type:"primary"},"打开"))},x=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var o=arguments.length,e=Array(o),c=0;c<o;c++)e[c]=arguments[c];return s=t=(0,m.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,m.default)(t,p)}return(0,h.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 y.default.createElement("div",{className:"zandoc-react-demo"},y.default.createElement("div",{className:"zandoc-react-demo__preview"},o),y.default.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},y.default.createElement("div",{className:"zandoc-react-demo__title"},y.default.createElement("p",null,s||"")),y.default.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle "+(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&y.default.createElement("pre",{className:"zandoc-react-demo__code"},y.default.createElement(p,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),a}(v.Component),R=function(n){function a(){return(0,k.default)(this,a),(0,m.default)(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return(0,h.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,w.default)(document.documentElement,0,c(a,-9))}}},{key:"render",value:function(){return y.default.createElement("div",{className:"zandoc-react-container",key:null},y.default.createElement(e,{style:".zent-doc-pop-container .zent-pop-wrapper {\n\t\t\tmargin-right: 10px;\n\t\t}\n\t\t.zent-doc-pop-container .zent-doc-pop-tag {\n\t\t\tborder: 1px solid #e5e5e5;\n\t\t\tborder-radius: 20%;\n\t\t\tpadding: 3px;\n\t\t\tfont-size: 12px;\n\t\t\tcursor: default;\n\t\t}\n\n.zent-doc-pop-positions {\n\t\tposition: relative;\n\t}\n\n.zent-doc-pop-positions-top-row, .zent-doc-pop-positions-bottom-row {\n\t\t\ttext-align: center;\n\t\t}\n\n.zent-doc-pop-positions-top-row .zent-pop-wrapper:not(:last-child), .zent-doc-pop-positions-bottom-row .zent-pop-wrapper:not(:last-child) {\n\t\t\t\tmargin-right: 10px\n\t\t\t}\n\n.zent-doc-pop-positions-bottom-row {\n\t\t\tmargin-top: 200px;\n\t\t}\n\n.zent-doc-pop-positions-left-col, .zent-doc-pop-positions-right-col {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tdisplay: -webkit-box;\n\t\t\tdisplay: -ms-flexbox;\n\t\t\tdisplay: flex;\n\t\t\t-webkit-box-pack: center;\n\t\t\t -ms-flex-pack: center;\n\t\t\t justify-content: center;\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-box-direction: normal;\n\t\t\t -ms-flex-direction: column;\n\t\t\t flex-direction: column;\n\t\t\theight: 100%;\n\t\t}\n\n.zent-doc-pop-positions-left-col .zent-pop-wrapper:not(:last-child), .zent-doc-pop-positions-right-col .zent-pop-wrapper:not(:last-child) {\n\t\t\t\tmargin-bottom: 10px\n\t\t\t}\n\n.zent-doc-pop-positions-left-col {\n\t\t\tleft: 0;\n\t\t}\n\n.zent-doc-pop-positions-right-col {\n\t\t\tright: 0;\n\t\t}\n\n.zent-doc-pop-positions .zent-pop-wrapper .zent-btn {\n\t\t\t\twidth: 100px;\n\t\t\t}\n\n.zent-doc-pop-none-trigger-container .zent-pop-wrapper {\n\t\t\tmargin-right: 10px;\n\t\t}"}),y.default.createElement(o,{html:'<h2 class="anchor-heading"><a href="#qi-pao-ti-shi-pop">¶</a><a href="javascript:void(0)" id="qi-pao-ti-shi-pop" class="anchor-point"></a>气泡提示 Pop</h2>\n<p>气泡提示组件</p>\n<h3 class="anchor-heading"><a href="#shi-yong-zhi-nan">¶</a><a href="javascript:void(0)" id="shi-yong-zhi-nan" class="anchor-point"></a>使用指南</h3>\n<ul>\n<li>多种触发方式:点击,鼠标移入,获得输入焦点</li>\n<li>支持 Tooltip 的使用方式</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>'}),y.default.createElement(x,{title:"三种触发方式: 点击,鼠标移入,获得输入焦点",id:"Demotrigger",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Button<span class="token punctuation">,</span> Input <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">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">=</span><span class="token punctuation">"</span>zent-doc-pop-container<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>Pop</span> <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hover<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</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>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>click<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</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>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>focus<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</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>Input</span> <span class="token attr-name">defaultValue</span><span class="token attr-value"><span class="token punctuation">=</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>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},y.default.createElement(b)),y.default.createElement(x,{title:"12种定位",id:"Demopositions",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Button <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">const</span> trigger <span class="token operator">=</span> <span class="token string">\'hover\'</span><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">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">=</span><span class="token punctuation">"</span>zent-doc-pop-positions<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 attr-name">className</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>zent-doc-pop-positions-top-row<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>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>top-left<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Top Left<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>Button</span><span class="token punctuation">></span></span>TopLeft<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>top-center<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Top Center<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>Button</span><span class="token punctuation">></span></span>TopCenter<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>top-right<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Top Right<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span><span class="token punctuation">></span></span>TopRight<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>zent-doc-pop-positions-bottom-row<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>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>bottom-left<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Bottom Left<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>Button</span><span class="token punctuation">></span></span>BottomLeft<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>bottom-center<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Bottom Center<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>Button</span><span class="token punctuation">></span></span>BottomCenter<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>bottom-right<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Bottom Right<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span><span class="token punctuation">></span></span>BottomRight<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>zent-doc-pop-positions-left-col<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>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>left-top<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Left Top<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>Button</span><span class="token punctuation">></span></span>LeftTop<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>left-center<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Left Center<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>Button</span><span class="token punctuation">></span></span>LeftCenter<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>left-bottom<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Left Bottom<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>Button</span><span class="token punctuation">></span></span>LeftBottom<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</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 attr-name">className</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>zent-doc-pop-positions-right-col<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>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>right-top<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Right Top<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>Button</span><span class="token punctuation">></span></span>RightTop<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>right-center<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Right Center<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>Button</span><span class="token punctuation">></span></span>RightCenter<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>trigger<span class="token punctuation">}</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>right-bottom<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Right Bottom<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>Button</span><span class="token punctuation">></span></span>RightBottom<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</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> mountNode\n<span class="token punctuation">)</span>'},y.default.createElement(E)),y.default.createElement(x,{title:"使用 `centerArrow` 来控制气泡小三角的位置",id:"Democenterarrow",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Button<span class="token punctuation">,</span> Input <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">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">=</span><span class="token punctuation">"</span>zent-doc-pop-container<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>Pop</span> <span class="token attr-name">centerArrow</span> <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hover<span class="token punctuation">"</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>top-left<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>centerArrow 为 true<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</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>zent-doc-pop-tag<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Y<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>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hover<span class="token punctuation">"</span></span> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>top-left<span class="token punctuation">"</span></span> <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>centerArrow 为 false<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</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>zent-doc-pop-tag<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</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},y.default.createElement(C)),y.default.createElement(x,{title:"Confirm 形式的气泡提示",id:"Democonfirm",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Sweetalert<span class="token punctuation">,</span> Button <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">Wrapper</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 <span class="token function-variable function">confirmHandler</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 Sweetalert<span class="token punctuation">.</span><span class="token function">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> <span class="token string">\'Pop关闭了\'</span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</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>Pop</span>\n <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>click<span class="token punctuation">"</span></span>\n <span class="token attr-name">content</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">onConfirm</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>confirmHandler<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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</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>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},y.default.createElement(z)),y.default.createElement(x,{title:"自定义 Confirm 形式的气泡提示按钮",id:"Democustomconfirm",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Sweetalert<span class="token punctuation">,</span> Button <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">Wrapper</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 <span class="token function-variable function">confirmHandler</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 Sweetalert<span class="token punctuation">.</span><span class="token function">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> <span class="token string">\'Pop关闭了\'</span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</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>Pop</span>\n <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>click<span class="token punctuation">"</span></span>\n <span class="token attr-name">content</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">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>danger<span class="token punctuation">"</span></span>\n <span class="token attr-name">confirmText</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Error<span class="token punctuation">"</span></span>\n <span class="token attr-name">cancelText</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Close<span class="token punctuation">"</span></span>\n <span class="token attr-name">onConfirm</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>confirmHandler<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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</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>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</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>Wrapper</span><span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},y.default.createElement(j)),y.default.createElement(x,{title:"延迟打开/关闭",id:"Demodelay",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Button <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">Controlled</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n visible<span class="token punctuation">:</span> <span class="token boolean">false</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onBeforeShow</span> <span class="token operator">=</span> <span class="token punctuation">(</span>cont<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token function">setTimeout</span><span class="token punctuation">(</span>cont<span class="token punctuation">,</span> <span class="token number">500</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onBeforeClose</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">return</span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span>resolve<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token function">setTimeout</span><span class="token punctuation">(</span>resolve<span class="token punctuation">,</span> <span class="token number">500</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span>\n <span class="token attr-name">content</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>延迟500ms关闭<span class="token punctuation">"</span></span>\n <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>click<span class="token punctuation">"</span></span>\n <span class="token attr-name">onBeforeShow</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>onBeforeShow<span class="token punctuation">}</span></span>\n <span class="token attr-name">onBeforeClose</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>onBeforeClose<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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>延迟500ms打开<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Controlled</span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},y.default.createElement(N)),y.default.createElement(x,{title:"外部控制显示隐藏",id:"Democontrolled",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Button <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">NoneTriggerDemo</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n visible<span class="token punctuation">:</span> <span class="token boolean">false</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">close</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">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n visible<span class="token punctuation">:</span> <span class="token boolean">false</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">open</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">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n visible<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 <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> content <span class="token operator">=</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>p style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> marginBottom<span class="token punctuation">:</span> <span class="token number">10</span> <span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span>可以在 Pop 内部关闭<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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</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>close<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>Button</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 keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>zent-doc-pop-none-trigger-container<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>Pop</span>\n <span class="token attr-name">content</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>content<span class="token punctuation">}</span></span>\n <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>none<span class="token punctuation">"</span></span>\n <span class="token attr-name">visible</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>visible<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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span> <span class="token attr-name">onClick</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>open<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>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">disabled</span><span class="token script language-javascript"><span class="token punctuation">=</span><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>visible<span class="token punctuation">}</span></span> <span class="token attr-name">onClick</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>close<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>Button</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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>NoneTriggerDemo</span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},y.default.createElement(_)),y.default.createElement(x,{title:"withPop 高阶组件",id:"Demowithpop",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Pop<span class="token punctuation">,</span> Button <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 comment">// 点击close按钮可以关闭弹层</span>\n<span class="token keyword">const</span> Content <span class="token operator">=</span> Pop<span class="token punctuation">.</span><span class="token function">withPop</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token function">Content</span><span class="token punctuation">(</span><span class="token punctuation">{</span> pop <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>Pop 内容<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>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>pop<span class="token punctuation">.</span>close<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>Button</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Pop</span> <span class="token attr-name">trigger</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>click<span class="token punctuation">"</span></span> <span class="token attr-name">content={<Content</span> <span class="token punctuation">/></span></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>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</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>Button</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Pop</span><span class="token punctuation">></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},y.default.createElement(T)),y.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<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>content</td>\n<td>弹层的内容</td>\n<td>node</td>\n<td>是</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>trigger</td>\n<td>触发方式</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'none\'</code></td>\n<td><code>\'click\'</code>\n, \n<code>\'hover\'</code>\n, \n<code>\'focus\'</code></td>\n</tr>\n<tr>\n<td>position</td>\n<td>弹出框的位置,命名规则:相对触发元素的位置+箭头相对于Pop的位置。接受函数形式,参考 \n<code>Popover.Position.create</code></td>\n<td>string \n|\n func</td>\n<td>否</td>\n<td><code>\'top-center\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>centerArrow</td>\n<td>是否按小箭头居中对齐trigger来定位</td>\n<td>bool</td>\n<td>否</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>header</td>\n<td>用户可以自定义头部</td>\n<td>node</td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>block</td>\n<td>弹层在文档流里是否以块级元素出现</td>\n<td>bool</td>\n<td>否</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onShow</td>\n<td>弹层打开后的回调函数</td>\n<td>func</td>\n<td>否</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onClose</td>\n<td>弹层关闭后的回调函数</td>\n<td>func</td>\n<td>否</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onBeforeShow</td>\n<td>弹层打开前的回调函数,只有用户触发的打开操作才会调用,外部设置\n<code>visible</code>\n不会调用</td>\n<td>func</td>\n<td>否</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onBeforeClose</td>\n<td>弹层关闭前的回调函数, 只有用户触发的关闭操作才会调用,外部设置\n<code>visible</code>\n不会调用</td>\n<td>func</td>\n<td>否</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onConfirm</td>\n<td>用户自定义回调,设置以后pop 表现为confirm</td>\n<td>func</td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onCancel</td>\n<td>用户使用 confirm 的时候可自定义取消的回调</td>\n<td>func</td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>confirmText</td>\n<td>用户自定义按钮名</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'确定\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>cancelText</td>\n<td>用户自定义取消按钮</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'取消\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>type</td>\n<td>影响确定按钮的样式</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'primary\'</code></td>\n<td><code>\'default\'</code>\n, \n<code>\'danger\'</code>\n, \n<code>\'success\'</code></td>\n</tr>\n<tr>\n<td>visible</td>\n<td>外部维护 \n<code>Pop</code>\n 的显示状态,此时外部拥有 \n<code>Pop</code>\n 的全部控制权,必须和 \n<code>onVisibleChange</code>\n 一起使用</td>\n<td>bool</td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onVisibleChange</td>\n<td>和 \n<code>visible</code>\n 一起使用</td>\n<td>func</td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onPositionUpdated</td>\n<td>位置更新时的回调,不保证调用这个函数时位置一定变化</td>\n<td>func</td>\n<td>否</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onPositionReady</td>\n<td>位置进入窗口时的回调,生命周期内只调用一次</td>\n<td>func</td>\n<td>否</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>containerSelector</td>\n<td>弹层的父节点CSS selector</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'body\'</code></td>\n<td>所有合法的CSS selector</td>\n</tr>\n<tr>\n<td>className</td>\n<td>自定义类名</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>wrapperClassName</td>\n<td>自定义trigger包裹节点的类名</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>prefix</td>\n<td>自定义前缀</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'zent\'</code></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>根据 <code>trigger</code> 值的不同, <code>Pop</code> 提供了一些额外的控制参数.</p>\n<h4 class="anchor-heading"><a href="#click">¶</a><a href="javascript:void(0)" id="click" class="anchor-point"></a>Click</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>closeOnClickOutside</td>\n<td>点击弹层和trigger节点外部时自动关闭</td>\n<td>bool</td>\n<td>否</td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>isOutside</td>\n<td>用来判断点击目标是否在外面的可选函数</td>\n<td>func</td>\n<td>否</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#hover">¶</a><a href="javascript:void(0)" id="hover" class="anchor-point"></a>Hover</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>mouseEnterDelay</td>\n<td>hover打开的延迟(单位:毫秒)</td>\n<td>number</td>\n<td>否</td>\n<td><code>200</code></td>\n</tr>\n<tr>\n<td>mouseLeaveDelay</td>\n<td>关闭的的延迟(单位:毫秒)</td>\n<td>number</td>\n<td>否</td>\n<td><code>200</code></td>\n</tr>\n<tr>\n<td>isOutside</td>\n<td>用来判断点击目标是否在外面的可选函数</td>\n<td>func</td>\n<td>否</td>\n<td></td>\n</tr>\n<tr>\n<td>quirk</td>\n<td>开启 Popover 的 quirk 模式,该模式下判断关闭条件时不需要先从内部移动出去</td>\n<td>bool</td>\n<td>否</td>\n<td><code>true</code></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#none">¶</a><a href="javascript:void(0)" id="none" class="anchor-point"></a>None</h4>\n<p>这种模式下 <code>onConfirm</code> 和 <code>onCancel</code> 不会自动关闭 <code>Pop</code>, 需要使用者自己在回调中控制 <code>visible</code> 来关闭 <code>Pop</code>.</p>\n<h4 class="anchor-heading"><a href="#withpop-gao-jie-zu-jian">¶</a><a href="javascript:void(0)" id="withpop-gao-jie-zu-jian" class="anchor-point"></a>withPop 高阶组件</h4>\n<p>这个高阶组件暴露了 <code>Pop</code> 内部的几个重要方法, 可能的使用场景: 在 <code>content</code> 内部手动关闭弹层.</p>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>open</td>\n<td>打开 Pop</td>\n<td>func</td>\n</tr>\n<tr>\n<td>close</td>\n<td>关闭 Pop</td>\n<td>func</td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#adjustposition-fang-fa">¶</a><a href="javascript:void(0)" id="adjustposition-fang-fa" class="anchor-point"></a><code>adjustPosition</code> 方法</h4>\n<p>用于手动调整 <code>Pop</code> 位置。</p>\n<h4 class="anchor-heading"><a href="#getwrappedpopover-fang-fa">¶</a><a href="javascript:void(0)" id="getwrappedpopover-fang-fa" class="anchor-point"></a><code>getWrappedPopover</code> 方法</h4>\n<p>用于获取内部的 <code>Popover</code> 实例。</p>\n<h3 class="anchor-heading"><a href="#faq">¶</a><a href="javascript:void(0)" id="faq" class="anchor-point"></a>FAQ</h3>\n<h4 class="anchor-heading"><a href="#centerarrow">¶</a><a href="javascript:void(0)" id="centerarrow" class="anchor-point"></a>centerArrow</h4>\n<p>默认情况下, <code>Pop</code> 根据 <code>position</code> 对齐的是弹层和trigger的边缘, 除了 <code>postion</code> 为 <code>\'*-center\'</code> 的情况下, 弹层上的小箭头和弹层边缘的间距是固定的, 因而在 trigger 特别小的情况下箭头会对齐到 trigger 外部. 这种情况下可以设置 <code>centerArrow</code> 为 <code>true</code>, 不管trigger大小如何, 箭头永远对齐在trigger中间, 弹层再相对箭头做定位.</p>\n<h4 class="anchor-heading"><a href="#onconfirm-he-oncancel">¶</a><a href="javascript:void(0)" id="onconfirm-he-oncancel" class="anchor-point"></a>onConfirm 和 onCancel</h4>\n<p>支持异步响应,此时按钮会变成loading状态。</p>\n<ul>\n<li>如果返回 <code>Promise</code>, <code>Pop</code> 会在 <code>Promise</code> <code>resolve</code> 后关闭.</li>\n<li>也支持参数形式的异步响应, 此时接受一个参数 <code>close</code>, 需要在函数内手动调用 <code>close</code> 函数.</li>\n</ul>'}))}}]),a}(v.Component);a.default=R}});