-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path141-bc4eac5649ec72ccd951.js
1 lines (1 loc) · 48.5 KB
/
141-bc4eac5649ec72ccd951.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[141],{660:function(n,a,t){"use strict";t.r(a),t.d(a,"default",function(){return F});var s=t(580),p=t.n(s),o=t(23),e=t.n(o),c=t(24),l=t.n(c),u=t(25),i=t.n(u),k=t(26),r=t.n(k),d=t(32),g=t.n(d),m=t(27),h=t.n(m),v=t(28),f=t.n(v),b=t(0),T=t.n(b),E=t(111),y=t(82),z=function(){return T.a.createElement("div",{className:"zent-doc-tooltip-container"},T.a.createElement(y.Fb,{trigger:"hover",title:"鼠标移入触发方式"},T.a.createElement(y.i,{type:"primary"},"移入鼠标")),T.a.createElement(y.Fb,{trigger:"click",title:"鼠标点击触发方式"},T.a.createElement(y.i,{type:"primary"},"点击鼠标")),T.a.createElement(y.Fb,{trigger:"focus",title:"获得输入焦点触发方式"},T.a.createElement(y.R,{defaultValue:"点击获取焦点"})))},w=function(){return T.a.createElement("div",{className:"zent-doc-tooltip-positions"},T.a.createElement("div",{className:"zent-doc-tooltip-positions-top-row"},T.a.createElement(y.Fb,{trigger:"hover",position:"top-left",title:"Top Left"},T.a.createElement(y.i,null,"TopLeft")),T.a.createElement(y.Fb,{trigger:"hover",position:"top-center",title:"Top Center"},T.a.createElement(y.i,null,"TopCenter")),T.a.createElement(y.Fb,{trigger:"hover",position:"top-right",title:"Top Right"},T.a.createElement(y.i,null,"TopRight"))),T.a.createElement("div",{className:"zent-doc-tooltip-positions-bottom-row"},T.a.createElement(y.Fb,{trigger:"hover",position:"bottom-left",title:"Bottom Left"},T.a.createElement(y.i,null,"BottomLeft")),T.a.createElement(y.Fb,{trigger:"hover",position:"bottom-center",title:"Bottom Center"},T.a.createElement(y.i,null,"BottomCenter")),T.a.createElement(y.Fb,{trigger:"hover",position:"bottom-right",title:"Bottom Right"},T.a.createElement(y.i,null,"BottomRight"))),T.a.createElement("div",{className:"zent-doc-tooltip-positions-left-col"},T.a.createElement(y.Fb,{trigger:"hover",position:"left-top",title:"Left Top"},T.a.createElement(y.i,null,"LeftTop")),T.a.createElement(y.Fb,{trigger:"hover",position:"left-center",title:"Left Center"},T.a.createElement(y.i,null,"LeftCenter")),T.a.createElement(y.Fb,{trigger:"hover",position:"left-bottom",title:"Left Bottom"},T.a.createElement(y.i,null,"LeftBottom"))),T.a.createElement("div",{className:"zent-doc-tooltip-positions-right-col"},T.a.createElement(y.Fb,{trigger:"hover",position:"right-top",title:"Right Top"},T.a.createElement(y.i,null,"RightTop")),T.a.createElement(y.Fb,{trigger:"hover",position:"right-center",title:"Right Center"},T.a.createElement(y.i,null,"RightCenter")),T.a.createElement(y.Fb,{trigger:"hover",position:"right-bottom",title:"Right Bottom"},T.a.createElement(y.i,null,"RightBottom"))))},B=function(){return T.a.createElement("div",{className:"zent-doc-tooltip-container"},T.a.createElement(y.Fb,{centerArrow:!0,trigger:"hover",position:"top-left",title:"centerArrow 为 true"},T.a.createElement("span",{className:"zent-doc-tooltip-tag"},"Y")),T.a.createElement(y.Fb,{trigger:"hover",position:"top-left",title:"centerArrow 为 false"},T.a.createElement("span",{className:"zent-doc-tooltip-tag"},"N")))},N=function(){var n=function(n){function a(){var n,t;e()(this,a);for(var s=arguments.length,p=new Array(s),o=0;o<s;o++)p[o]=arguments[o];return t=i()(this,(n=r()(a)).call.apply(n,[this].concat(p))),f()(g()(t),"state",{visible:!1}),f()(g()(t),"close",function(){t.setState({visible:!1})}),f()(g()(t),"open",function(){t.setState({visible:!0})}),t}return h()(a,n),l()(a,[{key:"render",value:function(){var n=T.a.createElement("div",null,T.a.createElement("p",{style:{marginBottom:10}},"可以在 Tooltip 内部关闭"),T.a.createElement(y.i,{type:"primary",onClick:this.close},"关闭"));return T.a.createElement("div",{className:"zent-doc-tooltip-none-trigger-container"},T.a.createElement(y.Fb,{title:n,trigger:"none",visible:this.state.visible},T.a.createElement(y.i,{type:"primary",onClick:this.open},"打开")),T.a.createElement(y.i,{disabled:!this.state.visible,onClick:this.close},"外部关闭"))}}]),a}(b.Component);return T.a.createElement(n,null)};function C(n){return T.a.createElement(n.tag,p()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function j(n){return T.a.createElement(C,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function R(n){return T.a.createElement(C,{tag:"style",html:n.style})}var L=function(n){function a(){var n,t;e()(this,a);for(var s=arguments.length,p=new Array(s),o=0;o<s;o++)p[o]=arguments[o];return t=i()(this,(n=r()(a)).call.apply(n,[this].concat(p))),f()(g()(t),"state",{showCode:!1}),f()(g()(t),"toggle",function(){t.setState({showCode:!t.state.showCode})}),t}return h()(a,n),l()(a,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,t=a.title,s=a.src,p=a.children;return T.a.createElement("div",{className:"zandoc-react-demo"},T.a.createElement("div",{className:"zandoc-react-demo__preview"},p),T.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},T.a.createElement("div",{className:"zandoc-react-demo__title"},T.a.createElement("p",null,t||"")),T.a.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&T.a.createElement("pre",{className:"zandoc-react-demo__code"},T.a.createElement(C,{tag:"code",html:s,attributes:{className:"language-jsx"}})))}}]),a}(b.Component),F=function(n){function a(){return e()(this,a),i()(this,r()(a).apply(this,arguments))}return h()(a,n),l()(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&Object(E.a)(document.documentElement,0,function n(a,t){for(;a;)return a.offsetTop&&"static"!==getComputedStyle(a).position&&(t+=a.offsetTop),n(a.parentNode,t);return t}(a,-9))}}},{key:"render",value:function(){return T.a.createElement("div",{className:"zandoc-react-container",key:null},T.a.createElement(R,{style:".zent-doc-tooltip-container {\n\t display: flex;\n justify-content: center;\n\t}\n\t\t.zent-doc-tooltip-container .zent-tooltip-wrapper {\n\t\t\tmargin-right: 10px;\n\t\t}\n\t\t.zent-doc-tooltip-container .zent-doc-tooltip-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-tooltip-positions {\n position: relative;\n }\n\n.zent-doc-tooltip-positions-top-row,\n\t\t.zent-doc-tooltip-positions-bottom-row {\n\t\t\tdisplay: flex;\n justify-content: center;\n }\n\n.zent-doc-tooltip-positions-top-row .zent-tooltip-wrapper:not(:last-child), .zent-doc-tooltip-positions-bottom-row .zent-tooltip-wrapper:not(:last-child) {\n margin-right: 10px\n }\n\n.zent-doc-tooltip-positions-bottom-row {\n margin-top: 200px;\n }\n\n.zent-doc-tooltip-positions-left-col, .zent-doc-tooltip-positions-right-col {\n position: absolute;\n top: 0;\n display: flex;\n justify-content: center;\n flex-direction: column;\n height: 100%;\n }\n\n.zent-doc-tooltip-positions-left-col .zent-tooltip-wrapper:not(:last-child), .zent-doc-tooltip-positions-right-col .zent-tooltip-wrapper:not(:last-child) {\n margin-bottom: 10px\n }\n\n.zent-doc-tooltip-positions-left-col {\n left: 0;\n }\n\n.zent-doc-tooltip-positions-right-col {\n right: 0;\n }\n\n.zent-doc-tooltip-positions .zent-tooltip-wrapper .zent-btn {\n width: 120px;\n }\n\n.zent-doc-tooltip-none-trigger-container {\n display: flex;\n justify-content: left;\n\t}\n\n.zent-doc-tooltip-none-trigger-container .zent-tooltip-wrapper {\n\t\t\tmargin-right: 10px;\n\t\t}"}),T.a.createElement(j,{html:'<h2 class="anchor-heading"><a href="#tooltip">¶</a><a href="javascript:void(0)" id="tooltip" class="anchor-point"></a>Tooltip</h2>\n<ul>\n<li>多种触发方式:点击,鼠标移入,获得输入焦点,默认为hover时触发</li>\n<li>只单纯做展示提示同<code>HTML title</code>属性,不承载过多的复杂操作</li>\n<li>api和pop组件一致</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>'}),T.a.createElement(L,{title:"三种触发方式: 点击,鼠标移入,获得输入焦点",id:"Demotrigger",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tooltip<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-tooltip-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>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</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>'},T.a.createElement(z)),T.a.createElement(L,{title:"12种定位",id:"Demopositions",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tooltip<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-tooltip-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-tooltip-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>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</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-tooltip-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>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</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-tooltip-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>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</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-tooltip-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>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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>Tooltip</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><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},T.a.createElement(w)),T.a.createElement(L,{title:"使用 `centerArrow` 来控制气泡小三角的位置",id:"Democenterarrow",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tooltip<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-tooltip-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>Tooltip</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">title</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-tooltip-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>Tooltip</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tooltip</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">title</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-tooltip-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>Tooltip</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>'},T.a.createElement(B)),T.a.createElement(L,{title:"外部控制显示隐藏",id:"Democontrolled",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tooltip<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>可以在 Tooltip 内部关闭<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-tooltip-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>Tooltip</span>\n <span class="token attr-name">title</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>Tooltip</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>'},T.a.createElement(N)),T.a.createElement(j,{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>title</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>\'hover\'</code></td>\n<td><code>\'click\'</code>\n, \n<code>\'hover\'</code>\n, \n<code>\'focus\'</code>\n, \n<code>\'none\'</code></td>\n</tr>\n<tr>\n<td>position</td>\n<td>弹出框的位置,命名规则:相对触发元素的位置+箭头相对于Tooltip的位置。接受函数形式,参考 \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>cushion</td>\n<td>与 Popover 中的\n<code>cushion</code>\n含义(定位的偏移量)相同,通常为弹框边缘与 trigger 元素之间的距离</td>\n<td>number</td>\n<td>否</td>\n<td><code>10</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>prefix</td>\n<td>自定义前缀</td>\n<td>string</td>\n<td>否</td>\n<td><code>\'zent\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>visible</td>\n<td>外部维护 \n<code>Tooltip</code>\n 的显示状态,此时外部拥有 \n<code>Tooltip</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</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#hong-fa-fang-shi-de-e-wai-api">¶</a><a href="javascript:void(0)" id="hong-fa-fang-shi-de-e-wai-api" class="anchor-point"></a>触发方式的额外API</h4>\n<p>根据 <code>trigger</code> 值的不同, <code>Tooltip</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>160</code></td>\n</tr>\n<tr>\n<td>mouseLeaveDelay</td>\n<td>关闭的的延迟(单位:毫秒)</td>\n<td>number</td>\n<td>否</td>\n<td><code>160</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>开启 Tooltip 的 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>visible</code> 来关闭 <code>Tooltip</code>.</p>'}))}}]),a}(b.Component)}}]);