{"id":31847,"date":"2024-11-25T11:02:20","date_gmt":"2024-11-25T03:02:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31847\/"},"modified":"2024-11-25T11:02:20","modified_gmt":"2024-11-25T03:02:20","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e4%b8%ad%e8%a1%a8%e5%8d%95form%e7%9a%84%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31847\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790"},"content":{"rendered":"<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u8868\u5355form\u5b9e\u4f8b\u8be6\u89e3\u7684\u76f8\u5173\u8d44\u6599,\u8fd9\u91cc\u5bf9form \u8868\u5355\u8fdb\u884c\u4e86\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5e76\u9644\u5b9e\u4f8b\u4ee3\u7801\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/p>\n<p><strong>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u8868\u5355Form\u5b9e\u4f8b<\/strong><\/p>\n<p><strong>\u8868\u5355Form\u7684\u5e94\u7528\u5f88\u5e7f\u6cdb\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528form\u8bbe\u8ba1\u767b\u5f55\u6ce8\u518c\uff0c\u4e5f\u53ef\u4ee5\u8bbe\u8ba1\u4e00\u79cd\u7b54\u9898\u95ee\u5377\u7684\u5f62\u5f0f\uff0c\u4eca\u5929\u4e3b\u8981\u8bb2\u4e00\u4e0bform\u7684\u4f7f\u7528<\/strong><\/p>\n<p>form\u8868\u5355\uff0c\u5c06\u7ec4\u4ef6\u5185\u8f93\u5165\u7684&#8221;switch&#8221;,&#8221;input&#8221;,&#8221;checkbox&#8221;,&#8221;slider&#8221;,&#8221;radio&#8221;,&#8221;picker&#8221;\u7684\u503c\u8fdb\u884c\u63d0\u4ea4,\u6570\u636e\u7684\u683c\u5f0f\u4e3a\uff1aname:value\uff0c\u6240\u4ee5\u8868\u5355\u4e2d\u63a7\u4ef6\u90fd\u9700\u8981\u6dfb\u52a0name\u5c5e\u6027\uff0c\u5426\u5219\u627e\u4e0d\u5230\u5bf9\u5e94\u63a7\u4ef6\u7684\u503c\u3002\u5176\u4e3b\u8981\u5c5e\u6027\uff1a<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/b0c9efb605eedb1a47e59b6fe7ceebff-0.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4e3b\u8981\u4ee3\u7801\uff0c\u521b\u5efa\u4e00\u4e2aform\u8868\u5355\uff1a<\/strong><\/p>\n<\/p>\n<pre>&lt;!--pages\/index\/Component\/FormM\/FormM.wxml--&gt;\n&lt;view&gt;\n&nbsp;&nbsp;&lt;text&gt;form\u8868\u5355&lt;\/text&gt;\n&nbsp;&nbsp;&lt;view&gt;&lt;\/view&gt;&lt;\/view&gt;&lt;!--\u8fd9\u91cc\u7528form\uff0cname=\u201cnameName1\u201d\u53ef\u4ee5\u4f5c\u4e3aform\u7684\u5c5e\u6027\u8fdb\u884c \n\uff08e.detail.value.nameName1\uff09\u8c03\u7528,\nform\u81ea\u5e26\u6709\u63d0\u4ea4\u548c\u91cd\u7f6e\u6309\u94ae\uff0c\u4f1a\u81ea\u52a8\u83b7\u53d6\u8868\u5355\u4e2d\u6240\u6709\u63a7\u4ef6\u503c\u7684\u6539\u53d8--&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch\u5f00\u5173 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; slider\u6ed1\u5757 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; input\u8f93\u5165\u6846 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; radio\u5355\u9009 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; radio1 &nbsp;&nbsp;&nbsp;&nbsp; radio2 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; checkbox\u591a\u9009 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; checkbox1 &nbsp;&nbsp;&nbsp;&nbsp; checkbox2 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \u5730\u533a\u9009\u62e9\u5668 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u5f53\u524d\u9009\u62e9\uff1a{{array[index]}} &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \u65f6\u95f4\u9009\u62e9\u5668 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u5f53\u524d\u9009\u62e9:&nbsp;{{time}} &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \u65e5\u671f\u9009\u62e9\u5668 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u5f53\u524d\u9009\u62e9:&nbsp;{{date}} &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Submit\u63d0\u4ea4 &nbsp;&nbsp;&nbsp; Reset\u91cd\u7f6e &nbsp;&nbsp; &nbsp; <\/p>\n<p><strong>\u5982\u4f55\u83b7\u53d6form\u5185\u90e8\u7684\u63a7\u4ef6\u7684\u503c\uff0c\u5c31\u9700\u8981\u7528\u5230form\u7684\u76f8\u5173\u5c5e\u6027\uff0c\u4ee3\u7801\u5982\u4e0b<\/strong><\/p>\n<\/p>\n<pre>\/\/&nbsp;pages\/index\/Component\/FormM\/FormM.js\nPage({\n&nbsp;\/\/\u521d\u59cb\u5316\u6570\u636e\n&nbsp;data:&nbsp;{\n&nbsp;&nbsp;array:&nbsp;['\u5927\u4e2d\u56fd',&nbsp;'\u7f8e\u56fd',&nbsp;'\u5df4\u897f',&nbsp;'\u5c0f\u65e5\u672c'],\n&nbsp;&nbsp;index:&nbsp;0,\n&nbsp;&nbsp;date:&nbsp;'2016-12-20',\n&nbsp;&nbsp;time:&nbsp;'11:19',\n&nbsp;&nbsp;allValue:''\n&nbsp;},\n&nbsp;\/\/\u8868\u5355\u63d0\u4ea4\u6309\u94ae\n&nbsp;formSubmit:&nbsp;function(e)&nbsp;{\n&nbsp;&nbsp;console.log('form\u53d1\u751f\u4e86submit\u4e8b\u4ef6\uff0c\u643a\u5e26\u6570\u636e\u4e3a\uff1a',&nbsp;e.detail.value)\n&nbsp;&nbsp;this.setData({\n&nbsp;&nbsp;&nbsp;allValue:e.detail.value\n&nbsp;&nbsp;})\n&nbsp;},\n&nbsp;\/\/\u8868\u5355\u91cd\u7f6e\u6309\u94ae\n&nbsp;formReset:&nbsp;function(e)&nbsp;{\n&nbsp;&nbsp;console.log('form\u53d1\u751f\u4e86reset\u4e8b\u4ef6\uff0c\u643a\u5e26\u6570\u636e\u4e3a\uff1a',&nbsp;e.detail.value)\n&nbsp;&nbsp;this.setData({\n&nbsp;&nbsp;&nbsp;allValue:''\n&nbsp;&nbsp;})\n&nbsp;},\n&nbsp;\/\/---------------------\u4e0e\u9009\u62e9\u5668\u76f8\u5173\u7684\u65b9\u6cd5\n&nbsp;\/\/\u5730\u533a\u9009\u62e9\n&nbsp;bindPickerChange:&nbsp;function(e)&nbsp;{\n&nbsp;&nbsp;console.log('picker\u53d1\u9001\u9009\u62e9\u6539\u53d8\uff0c\u643a\u5e26\u503c\u4e3a',&nbsp;e.detail.value)\n&nbsp;&nbsp;this.setData({\n&nbsp;&nbsp;&nbsp;index:&nbsp;e.detail.value\n&nbsp;&nbsp;})\n&nbsp;},\n&nbsp;\/\/\u65e5\u671f\u9009\u62e9\n&nbsp;bindDateChange:&nbsp;function(e)&nbsp;{\n&nbsp;&nbsp;this.setData({\n&nbsp;&nbsp;&nbsp;date:&nbsp;e.detail.value\n&nbsp;&nbsp;})\n&nbsp;},\n&nbsp;\/\/\u65f6\u95f4\u9009\u62e9\n&nbsp;bindTimeChange:&nbsp;function(e)&nbsp;{\n&nbsp;&nbsp;this.setData({\n&nbsp;&nbsp;&nbsp;time:&nbsp;e.detail.value\n&nbsp;&nbsp;})\n&nbsp;},\n\n\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6548\u679c\u56fe\uff1a<\/strong><\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/bd4d849cc4547690febf0a605be9994a-1.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe1\" \/>&nbsp;&nbsp; <img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/bd4d849cc4547690febf0a605be9994a-2.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe2\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe2\" \/>&nbsp;&nbsp; <img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/db500dbeba66fe6cc47bd62b86cfc9c8-3.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe3\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe3\" \/>&nbsp;&nbsp; <img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/db500dbeba66fe6cc47bd62b86cfc9c8-4.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe4\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe4\" \/><\/p>\n<p><strong>\u8f93\u51fa\u8868\u5355\u4e2d\u7684\u7ed3\u679c\u503c\uff1a<\/strong><\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/8a2b19c237705af6972d81bbdab4518d-5.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe5\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\u63d2\u56fe5\" \/><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff0c\u66f4\u591a\u76f8\u5173\u5185\u5bb9\u8bf7\u5173\u6ce8PHP\u4e2d\u6587\u7f51\uff01<\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<\/p>\n<p><span><\/span><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u8868\u5355Form\u7684\u89e3\u6790\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 \u8868\u5355form\u5b9e\u4f8b\u8be6\u89e3\u7684\u76f8\u5173\u8d44\u6599,\u8fd9\u91cc\u5bf9form \u8868\u5355\u8fdb\u884c\u4e86\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5e76\u9644\u5b9e\u4f8b\u4ee3\u7801\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b \u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u8868\u5355Form\u5b9e\u4f8b \u8868\u5355Form\u7684\u5e94\u7528\u5f88\u5e7f\u6cdb\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528form\u8bbe\u8ba1\u767b\u5f55\u6ce8\u518c\uff0c\u4e5f\u53ef\u4ee5\u8bbe\u8ba1\u4e00\u79cd\u7b54\u9898\u95ee\u5377\u7684\u5f62\u5f0f\uff0c\u4eca\u5929\u4e3b\u8981\u8bb2\u4e00\u4e0bform\u7684\u4f7f\u7528 form\u8868\u5355\uff0c\u5c06\u7ec4\u4ef6\u5185\u8f93\u5165\u7684&#8221;switch&#8221;,&#8221;input&#8221;,&#8221;checkbox&#8221;,&#8221;slider&#8221;,&#8221;radio&#8221;,&#8221;picker&#8221;\u7684\u503c\u8fdb\u884c\u63d0\u4ea4,\u6570\u636e\u7684\u683c\u5f0f\u4e3a\uff1aname:value\uff0c\u6240\u4ee5\u8868\u5355\u4e2d\u63a7\u4ef6\u90fd\u9700\u8981\u6dfb\u52a0name\u5c5e\u6027\uff0c\u5426\u5219\u627e\u4e0d\u5230\u5bf9\u5e94\u63a7\u4ef6\u7684\u503c\u3002\u5176\u4e3b\u8981\u5c5e\u6027\uff1a \u4e3b\u8981\u4ee3\u7801\uff0c\u521b\u5efa\u4e00\u4e2aform\u8868\u5355\uff1a &lt;!&#8211;pages\/index\/Component\/FormM\/FormM.wxml&#8211;&gt; &lt;view&gt; &nbsp;&nbsp;&lt;text&gt;form\u8868\u5355&lt;\/text&gt; &nbsp;&nbsp;&lt;view&gt;&lt;\/view&gt;&lt;\/view&gt;&lt;!&#8211;\u8fd9\u91cc\u7528form\uff0cname=\u201cnameName1\u201d\u53ef\u4ee5\u4f5c\u4e3aform\u7684\u5c5e\u6027\u8fdb\u884c \uff08e.detail.value.nameName1\uff09\u8c03\u7528, form\u81ea\u5e26\u6709\u63d0\u4ea4\u548c\u91cd\u7f6e\u6309\u94ae\uff0c\u4f1a\u81ea\u52a8\u83b7\u53d6\u8868\u5355\u4e2d\u6240\u6709\u63a7\u4ef6\u503c\u7684\u6539\u53d8&#8211;&gt; \u767b\u5f55\u540e\u590d\u5236 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch\u5f00\u5173 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; slider\u6ed1\u5757 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; input\u8f93\u5165\u6846 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; radio\u5355\u9009 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; radio1 &nbsp;&nbsp;&nbsp;&nbsp; radio2 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; checkbox\u591a\u9009 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; checkbox1 &nbsp;&nbsp;&nbsp;&nbsp; checkbox2 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \u5730\u533a\u9009\u62e9\u5668 &nbsp;&nbsp;&nbsp; &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-31847","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31847","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=31847"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31847\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31847"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}