{"id":30092,"date":"2024-11-25T13:43:03","date_gmt":"2024-11-25T05:43:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30092\/"},"modified":"2024-11-25T13:43:03","modified_gmt":"2024-11-25T05:43:03","slug":"%e5%be%ae%e4%bf%a1%e5%bc%80%e5%8f%91%e4%b8%ad%e8%af%a6%e8%a7%a3textarea%e7%9a%84%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30092\/","title":{"rendered":"\u5fae\u4fe1\u5f00\u53d1\u4e2d\u8be6\u89e3textarea\u7684\u4f7f\u7528\u65b9\u6cd5"},"content":{"rendered":"<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f textarea \u8be6\u89e3\u53ca\u7b80\u5355\u4f7f\u7528\u65b9\u6cd5\u7684\u76f8\u5173\u8d44\u6599,\u8fd9\u91cc\u9644\u6709\u5b9e\u73b0\u5b9e\u4f8b\u4ee3\u7801\uff0c\u53ca\u89e3\u51b3textarea\u6ca1\u6709bindchange\u4e8b\u4ef6\uff0c\u65e0\u6cd5\u5728\u8f93\u5165\u65f6\u7ed9\u53d8\u91cf\u8d4b\u503c\u7684\u65b9\u6cd5\uff0c \u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/p>\n<p><strong>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f textarea \u7b80\u6613\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2dtextarea\u6ca1\u6709bindchange\u4e8b\u4ef6\uff0c\u6240\u4ee5\u65e0\u6cd5\u5728\u8f93\u5165\u65f6\u7ed9\u53d8\u91cf\u8d4b\u503c\u3002<\/p>\n<p>\u867d\u7136\u53ef\u4ee5\u4f7f\u7528bindblur\u4e8b\u4ef6\uff0c\u4f46\u662f\u7ed1\u5b9abindblur\u4e8b\u4ef6\uff0c\u5982\u679c\u518d\u70b9\u51fb\uff0c\u5219\u5148\u6267\u884c\u5b8c\u6309\u94ae\u4e8b\u4ef6\u540e\uff0c\u518d\u53bb\u6267\u884cbindblur\u4e8b\u4ef6\uff0c\u6240\u4ee5\u5728\u6587\u4ef6\u53d6\u4e0d\u5230\u8f93\u5165\u503c\uff0c<\/p>\n<p><span style=\"color: #0000ff\">\u89e3\u51b3\u65b9\u6cd5\uff1a<\/span><span style=\"color: #ff0000\">\u7ed3\u5408from\u8868\u5355\uff0ctextarea\u6587\u672c\u6846\u8f93\u5165\u540e\uff0c\u518d\u53bb\u70b9\u51fb\u63d0\u4ea4\u6309\u94ae\uff0c\u8fd9\u65f6\u4f1a\u5148\u6267\u884ctextarea\u4e8b\u4ef6\uff08\u83b7\u53d6\u6587\u672c\u6846\u8f93\u5165\u5185\u5bb9\uff09\uff0c\u518d\u53bb\u6267\u884c\u6570\u636e\u63d0\u4ea4\uff0c\u8fd9\u6837\u95ee\u9898\u5c31\u89e3\u51b3\u4e86<\/span><\/p>\n<p><strong>w\u6587\u4ef6\u4ee3\u7801\uff1a<\/strong><\/p>\n<p><\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \u63d0\u4ea4 &nbsp; <\/p>\n<p><strong>js\u6587\u4ef6\u4ee3\u7801\uff1a<\/strong><\/p>\n<p><\/p>\n<pre>var&nbsp;app&nbsp;=&nbsp;getApp();\r\nPage({\r\n&nbsp;data:{\r\n&nbsp;&nbsp;&nbsp;evaContent&nbsp;&nbsp;:&nbsp;''\r\n&nbsp;},\r\n&nbsp;onLoad:function(){\r\n&nbsp;},\r\n&nbsp;onReady:function(){\r\n&nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u6e32\u67d3\u5b8c\u6210\r\n&nbsp;},\r\n&nbsp;onShow:function(){\r\n&nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u663e\u793a\r\n&nbsp;},\r\n&nbsp;onHide:function(){\r\n&nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u9690\u85cf\r\n&nbsp;},\r\n&nbsp;onUnload:function(){\r\n&nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u5173\u95ed\r\n&nbsp;},\r\n&nbsp;\/\/\u4e8b\u4ef6\r\n&nbsp;textBlur:&nbsp;function(e){\r\n&nbsp;&nbsp;&nbsp;if(e.detail&amp;amp;&amp;amp;e.detail.value.length&amp;gt;0){\r\n&nbsp;&nbsp;&nbsp;&nbsp;if(e.detail.value.length500){\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/app.func.showToast('\u5185\u5bb9\u4e3a12-500\u4e2a\u5b57\u7b26','loading',1200);\r\n&nbsp;&nbsp;&nbsp;&nbsp;}else{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;evaContent&nbsp;:&nbsp;e.detail.value\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;}else{\r\n&nbsp;&nbsp;&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;evaContent&nbsp;:&nbsp;''\r\n&nbsp;&nbsp;&nbsp;&nbsp;});\r\n&nbsp;&nbsp;&nbsp;&nbsp;evaData.evaContent&nbsp;=&nbsp;'';\r\n&nbsp;&nbsp;&nbsp;&nbsp;app.func.showToast('\u8bf7\u8f93\u5165\u6295\u8bc9\u5185\u5bb9','loading',1200);\r\n&nbsp;&nbsp;&nbsp;}\r\n&nbsp;},\r\n&nbsp;\/\/\u63d0\u4ea4\u4e8b\u4ef6\r\n&nbsp;evaSubmit:function(eee){&nbsp;&nbsp;\r\n&nbsp;&nbsp;var&nbsp;that&nbsp;=&nbsp;this;\r\n&nbsp;&nbsp;\/\/\u63d0\u4ea4(\u81ea\u5b9a\u4e49\u7684get\u65b9\u6cd5)\r\n&nbsp;&nbsp;app.func.req('http:\/\/localhost:1111\/ffeva\/complaint?content=''+this.data.evaContent),get,function(res){\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(res);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(res.result==='1'){\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u8df3\u8f6c\u5230\u9996\u9875\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app.func.showToast('\u63d0\u4ea4\u6210\u529f','loading',1200);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app.func.showToast('\u63d0\u4ea4\u5931\u8d25','loading',1200);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;});\r\n&nbsp;}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color: #ff0000\">&nbsp;\u7f3a\u70b9\uff1a<\/span><\/p>\n<p>\u8fd9\u6837\u64cd\u4f5c\u540e\uff0c\u529f\u80fd\u5c31\u6709\u7f3a\u9677\u3002\u4f8b\u5982\uff0c\u65e0\u6cd5\u5373\u65f6\u83b7\u53d6\u7528\u6237\u6587\u672c\u6846\u4e2a\u6570\uff0c\u5982\u679c\u6709\u66f4\u597d\u7684\u89e3\u51b3\u65b9\u6cd5\uff0c\u5e0c\u671b\u80fd\u5b66\u4e60\u4e00\u4e0b\uff01<\/p>\n<p>\u3010\u76f8\u5173\u63a8\u8350\u3011<\/p>\n<p>1. <\/p>\n<p>2. <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5f00\u53d1\u4e2d\u8be6\u89e3textarea\u7684\u4f7f\u7528\u65b9\u6cd5\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f textarea \u8be6\u89e3\u53ca\u7b80\u5355\u4f7f\u7528\u65b9\u6cd5\u7684\u76f8\u5173\u8d44\u6599,\u8fd9\u91cc\u9644\u6709\u5b9e\u73b0\u5b9e\u4f8b\u4ee3\u7801\uff0c\u53ca\u89e3\u51b3textarea\u6ca1\u6709bindchange\u4e8b\u4ef6\uff0c\u65e0\u6cd5\u5728\u8f93\u5165\u65f6\u7ed9\u53d8\u91cf\u8d4b\u503c\u7684\u65b9\u6cd5\uff0c \u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b \u5fae\u4fe1\u5c0f\u7a0b\u5e8f textarea \u7b80\u6613\u89e3\u51b3\u65b9\u6848 \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2dtextarea\u6ca1\u6709bindchange\u4e8b\u4ef6\uff0c\u6240\u4ee5\u65e0\u6cd5\u5728\u8f93\u5165\u65f6\u7ed9\u53d8\u91cf\u8d4b\u503c\u3002 \u867d\u7136\u53ef\u4ee5\u4f7f\u7528bindblur\u4e8b\u4ef6\uff0c\u4f46\u662f\u7ed1\u5b9abindblur\u4e8b\u4ef6\uff0c\u5982\u679c\u518d\u70b9\u51fb\uff0c\u5219\u5148\u6267\u884c\u5b8c\u6309\u94ae\u4e8b\u4ef6\u540e\uff0c\u518d\u53bb\u6267\u884cbindblur\u4e8b\u4ef6\uff0c\u6240\u4ee5\u5728\u6587\u4ef6\u53d6\u4e0d\u5230\u8f93\u5165\u503c\uff0c \u89e3\u51b3\u65b9\u6cd5\uff1a\u7ed3\u5408from\u8868\u5355\uff0ctextarea\u6587\u672c\u6846\u8f93\u5165\u540e\uff0c\u518d\u53bb\u70b9\u51fb\u63d0\u4ea4\u6309\u94ae\uff0c\u8fd9\u65f6\u4f1a\u5148\u6267\u884ctextarea\u4e8b\u4ef6\uff08\u83b7\u53d6\u6587\u672c\u6846\u8f93\u5165\u5185\u5bb9\uff09\uff0c\u518d\u53bb\u6267\u884c\u6570\u636e\u63d0\u4ea4\uff0c\u8fd9\u6837\u95ee\u9898\u5c31\u89e3\u51b3\u4e86 w\u6587\u4ef6\u4ee3\u7801\uff1a \u767b\u5f55\u540e\u590d\u5236 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \u63d0\u4ea4 &nbsp; js\u6587\u4ef6\u4ee3\u7801\uff1a var&nbsp;app&nbsp;=&nbsp;getApp(); Page({ &nbsp;data:{ &nbsp;&nbsp;&nbsp;evaContent&nbsp;&nbsp;:&nbsp;&#8221; &nbsp;}, &nbsp;onLoad:function(){ &nbsp;}, &nbsp;onReady:function(){ &nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u6e32\u67d3\u5b8c\u6210 &nbsp;}, &nbsp;onShow:function(){ &nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u663e\u793a &nbsp;}, &nbsp;onHide:function(){ &nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u9690\u85cf &nbsp;}, &nbsp;onUnload:function(){ &nbsp;&nbsp;\/\/&nbsp;\u9875\u9762\u5173\u95ed &nbsp;}, &nbsp;\/\/\u4e8b\u4ef6 &nbsp;textBlur:&nbsp;function(e){ &nbsp;&nbsp;&nbsp;if(e.detail&amp;amp;&amp;amp;e.detail.value.length&amp;gt;0){ &nbsp;&nbsp;&nbsp;&nbsp;if(e.detail.value.length500){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/app.func.showToast(&#8216;\u5185\u5bb9\u4e3a12-500\u4e2a\u5b57\u7b26&#8217;,&#8217;loading&#8217;,1200); &nbsp;&nbsp;&nbsp;&nbsp;}else{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.setData({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;evaContent&nbsp;:&nbsp;e.detail.value &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;}else{ &nbsp;&nbsp;&nbsp;&nbsp;this.setData({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;evaContent&nbsp;:&nbsp;&#8221; &nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;evaData.evaContent&nbsp;=&nbsp;&#8221;; &nbsp;&nbsp;&nbsp;&nbsp;app.func.showToast(&#8216;\u8bf7\u8f93\u5165\u6295\u8bc9\u5185\u5bb9&#8217;,&#8217;loading&#8217;,1200); &nbsp;&nbsp;&nbsp;} &nbsp;}, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-30092","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=30092"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30092\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}