-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path63-a28f22da2d828c0b81f9.js
1 lines (1 loc) · 33.7 KB
/
63-a28f22da2d828c0b81f9.js
1
webpackJsonp([63],{1552: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,l.default)({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function e(n){return y.default.createElement(p,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function o(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 u=s(7),l=t(u),i=s(1),k=t(i),r=s(4),d=t(r),g=s(2),h=t(g),f=s(3),m=t(f),v=s(0),y=t(v),w=s(232),C=t(w),b=s(359),_=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return s=t=(0,h.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(o))),t.state={text:"",suggestions:[]},t.onValueChange=function(n){t.setState({text:n})},t.onSearchChange=function(n){var a=[];if(n)for(var s=n,p=0;p<4;p++)a.push({content:s,value:p}),s+=n;t.setState({suggestions:a})},p=s,(0,h.default)(t,p)}return(0,m.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){return y.default.createElement(b.Mention,{value:this.state.text,onChange:this.onValueChange,onSearchChange:this.onSearchChange,suggestions:this.state.suggestions})}}]),a}(y.default.Component);return y.default.createElement(n,null)},x=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return s=t=(0,h.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(o))),t.state={text:"",suggestions:[{content:"Item 1",value:100},{content:"Item 2",value:200},{content:"Item 3",value:300},{content:"Item 4",value:400},{content:"Item 5",value:500}]},t.onValueChange=function(n){t.setState({text:n})},p=s,(0,h.default)(t,p)}return(0,m.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){return y.default.createElement(b.Mention,{value:this.state.text,onChange:this.onValueChange,suggestions:this.state.suggestions,multiLine:!0})}}]),a}(y.default.Component);return y.default.createElement(n,null)},E=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return s=t=(0,h.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(o))),t.state={text:"",suggestions:[{content:"Item 1",value:100},{content:"Item 2",value:200},{content:"Item 3",value:300},{content:"Item 4",value:400},{content:"Item 5",value:500}]},t.onValueChange=function(n){t.setState({text:n})},p=s,(0,h.default)(t,p)}return(0,m.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){return y.default.createElement(b.Mention,{value:this.state.text,onChange:this.onValueChange,suggestions:this.state.suggestions,position:"top"})}}]),a}(y.default.Component);return y.default.createElement(n,null)},M=function(){var n=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return s=t=(0,h.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(o))),t.state={text:"",suggestions:[]},t.onValueChange=function(n){t.setState({text:n})},t.onSearchChange=function(n){var a=[];if(n)for(var s=n,p=0;p<4;p++)a.push({content:s,value:p}),s+=n;t.setState({suggestions:a})},p=s,(0,h.default)(t,p)}return(0,m.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){return y.default.createElement(b.Mention,{value:this.state.text,onChange:this.onValueChange,onSearchChange:this.onSearchChange,suggestions:this.state.suggestions,addonBefore:"Buy",addonAfter:"Apple"})}}]),a}(y.default.Component);return y.default.createElement(n,null)},S=function(n){function a(){var n,s,t,p;(0,k.default)(this,a);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return s=t=(0,h.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(o))),t.state={showCode:!1},t.toggle=function(){t.setState({showCode:!t.state.showCode})},p=s,(0,h.default)(t,p)}return(0,m.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,e=a.children;return y.default.createElement("div",{className:"zandoc-react-demo"},y.default.createElement("div",{className:"zandoc-react-demo__preview"},e),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),j=function(n){function a(){return(0,k.default)(this,a),(0,h.default)(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return(0,m.default)(a,n),(0,d.default)(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'+n+'"]');a&&(0,C.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(o,{style:""}),y.default.createElement(e,{html:'<h2 class="anchor-heading"><a href="#mention-ti-ji">¶</a><a href="javascript:void(0)" id="mention-ti-ji" class="anchor-point"></a>Mention 提及</h2>\n<p>用于自动补全提及的内容,例如常见的 @某人。</p>\n<h3 class="anchor-heading"><a href="#dai-ma-yan-shi">¶</a><a href="javascript:void(0)" id="dai-ma-yan-shi" class="anchor-point"></a>代码演示</h3>'}),y.default.createElement(S,{title:"基础用法",id:"Demobasic",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Mention <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">MentionDemo</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'\'</span><span class="token punctuation">,</span>\n suggestions<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onValueChange</span> <span class="token operator">=</span> val <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 text<span class="token punctuation">:</span> val<span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onSearchChange</span> <span class="token operator">=</span> search <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> suggestions <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n <span class="token keyword">if</span> <span class="token punctuation">(</span>search<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> v <span class="token operator">=</span> search<span class="token punctuation">;</span>\n <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator"><</span> <span class="token number">4</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n suggestions<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> v<span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> i<span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n v <span class="token operator">=</span> v <span class="token operator">+</span> search<span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span>\n\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 suggestions<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>Mention</span>\n <span class="token attr-name">value</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>text<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onValueChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">onSearchChange</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>onSearchChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">suggestions</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>suggestions<span class="token punctuation">}</span></span>\n <span class="token punctuation">/></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\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>MentionDemo</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(_)),y.default.createElement(S,{title:"多行模式",id:"Demomultiline",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Mention <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">MentionDemo</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'\'</span><span class="token punctuation">,</span>\n suggestions<span class="token punctuation">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 1\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">100</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 2\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">200</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 3\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">300</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 4\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">400</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 5\'</span><span class="token punctuation">,</span> value<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 <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onValueChange</span> <span class="token operator">=</span> val <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 text<span class="token punctuation">:</span> val<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>Mention</span>\n <span class="token attr-name">value</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>text<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onValueChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">suggestions</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>suggestions<span class="token punctuation">}</span></span>\n <span class="token attr-name">multiLine</span>\n <span class="token punctuation">/></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\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>MentionDemo</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(x)),y.default.createElement(S,{title:"弹层位置",id:"Demoposition",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Mention <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">MentionDemo</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'\'</span><span class="token punctuation">,</span>\n suggestions<span class="token punctuation">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 1\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">100</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 2\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">200</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 3\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">300</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 4\'</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token number">400</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>\n <span class="token punctuation">{</span> content<span class="token punctuation">:</span> <span class="token string">\'Item 5\'</span><span class="token punctuation">,</span> value<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 <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onValueChange</span> <span class="token operator">=</span> val <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 text<span class="token punctuation">:</span> val<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>Mention</span>\n <span class="token attr-name">value</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>text<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onValueChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">suggestions</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>suggestions<span class="token punctuation">}</span></span>\n <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>top<span class="token punctuation">"</span></span>\n <span class="token punctuation">/></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\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>MentionDemo</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(E)),y.default.createElement(S,{title:"Input 有 Prefix 和 Suffix",id:"Demowithinputprefix",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Mention <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">MentionDemo</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'\'</span><span class="token punctuation">,</span>\n suggestions<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onValueChange</span> <span class="token operator">=</span> val <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 text<span class="token punctuation">:</span> val<span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onSearchChange</span> <span class="token operator">=</span> search <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> suggestions <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n <span class="token keyword">if</span> <span class="token punctuation">(</span>search<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> v <span class="token operator">=</span> search<span class="token punctuation">;</span>\n <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator"><</span> <span class="token number">4</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n suggestions<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> v<span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> i<span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n v <span class="token operator">=</span> v <span class="token operator">+</span> search<span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span>\n\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 suggestions<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>Mention</span>\n <span class="token attr-name">value</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>text<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onValueChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">onSearchChange</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>onSearchChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">suggestions</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>suggestions<span class="token punctuation">}</span></span>\n <span class="token attr-name">addonBefore</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Buy<span class="token punctuation">"</span></span> <span class="token attr-name">addonAfter</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Apple<span class="token punctuation">"</span></span>\n <span class="token punctuation">/></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\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>MentionDemo</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(M)),y.default.createElement(e,{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>value</td>\n<td>输入框的内容</td>\n<td><code>string</code></td>\n<td>是</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>输入框内容变化时的回调函数</td>\n<td><code>(val: string): void</code></td>\n<td>是</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>onSearchChange</td>\n<td>触发提及的搜索文字变化时的回调函数</td>\n<td><code>(search: string): void</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>multiLine</td>\n<td>输入框是否是多行模式</td>\n<td><code>bool</code></td>\n<td>否</td>\n<td><code>false</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>position</td>\n<td>弹层相对文字的位置</td>\n<td><code>string</code></td>\n<td>否</td>\n<td><code>bottom</code></td>\n<td><code>top</code></td>\n</tr>\n<tr>\n<td>suggestions</td>\n<td>提及的提示内容</td>\n<td><code>array</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>suggestionNotFoundContent</td>\n<td>提及的提示为空时的提示内容</td>\n<td><code>node</code></td>\n<td><code>\'无匹配结果,轻敲空格完成输入\'</code></td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>triggerText</td>\n<td>提及的触发前缀</td>\n<td><code>string</code></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><code>string</code></td>\n<td>否</td>\n<td><code>\'zent\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>className</td>\n<td>自定义类名</td>\n<td><code>string</code></td>\n<td>否</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<blockquote>\n<p><code>Mention</code> 支持 <code>Input</code> 的 props,例如 <code>placeholder</code> 等。</p>\n</blockquote>\n<h4 class="anchor-heading"><a href="#zhi-chi-de-suggestions-shu-zu-xing-shi">¶</a><a href="javascript:void(0)" id="zhi-chi-de-suggestions-shu-zu-xing-shi" class="anchor-point"></a>支持的 <code>suggestions</code> 数组形式</h4>\n<p><code>suggestions</code> 数组中每一项可以是以下任意一种:</p>\n<ul>\n<li>字符串</li>\n<li>数字</li>\n<li>对象</li>\n</ul>\n<p>对象形式支持的字段如下:</p>\n<table class="table">\n<thead>\n<tr>\n<th>字段</th>\n<th>说明</th>\n<th>类型</th>\n<th>是否必须</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>value</td>\n<td>选中时对应的值</td>\n<td><code>string</code></td>\n<td>是</td>\n</tr>\n<tr>\n<td>content</td>\n<td>选项的描述,不填默认使用 \n<code>value</code></td>\n<td><code>node</code></td>\n<td>否</td>\n</tr>\n<tr>\n<td>icon</td>\n<td>图标类型</td>\n<td><code>string</code></td>\n<td>否</td>\n</tr>\n<tr>\n<td>disabled</td>\n<td>选项是否禁用</td>\n<td><code>bool</code></td>\n<td>否</td>\n</tr>\n<tr>\n<td>isGroup</td>\n<td>是否是分组标题</td>\n<td><code>bool</code></td>\n<td>否</td>\n</tr>\n<tr>\n<td>isDivider</td>\n<td>是否是分割线</td>\n<td><code>bool</code></td>\n<td>否</td>\n</tr>\n</tbody>\n</table>'}))}}]),a}(v.Component);a.default=j}});