{"id":32524,"date":"2024-11-25T14:58:04","date_gmt":"2024-11-25T06:58:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/32524\/"},"modified":"2024-11-25T14:58:04","modified_gmt":"2024-11-25T06:58:04","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e4%b8%8b%e6%8b%89%e6%a1%86%e7%bb%84%e4%bb%b6%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/32524\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e0b\u62c9\u6846\u7ec4\u4ef6\u4f7f\u7528\u65b9\u6cd5"},"content":{"rendered":"<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e0b\u62c9\u6846\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5199\u7684\u5341\u5206\u7684\u5168\u9762\u7ec6\u81f4\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u5bf9\u6b64\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u5b66\u4e60\u4e0b\u3002\u5982\u6709\u4e0d\u8db3\u4e4b\u5904\uff0c\u6b22\u8fce\u6279\u8bc4\u6307\u6b63\u3002\u3010\u63a8\u8350\u6559\u7a0b\uff1a\u3011<\/p>\n<p>\u9002\u7528\u573a\u666f<\/p>\n<p>1\u3001\u7701\u5e02\u4e09\u7ea7\u8054\u52a8<br \/>2\u3001\u51fa\u751f\u65e5\u671f\u9009\u62e9<br \/>3\u3001\u6027\u522b\u9009\u62e9<br \/>4\u3001\u4e00\u822c\u6027\u7684\u4e0b\u62c9\u9009\u62e9\u7b49<\/p>\n<p><strong>\u4e00\u3001\u7701\u5e02\u4e09\u7ea7\u8054\u52a8\u4f7f\u7528<\/strong><\/p>\n<p>\u6ce8\u610fmode = region\uff0c\u4ee5\u53cavalue = \u201c\u4e00\u7ef4\u6570\u7ec4\u201d<\/p>\n<pre>\/\/.wxml\n&lt;picker data-method=\"bindSelect\"&gt;&lt;view&gt;\n&nbsp;&nbsp;&nbsp;\u5f53\u524d\u9009\u62e9\uff1a{{region[0]}}\uff0c{{region[1]}}\uff0c{{region[2]}}\n&lt;\/view&gt;&lt;\/picker&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4e8c\u3001\u51fa\u751f\u65e5\u671f\u9009\u62e9<\/strong><\/p>\n<p>\u6ce8\u610fmode = date\uff0c\u4ee5\u53cavalue = \u201c\u65e5\u671f\u5b57\u7b26\u4e32\u201d<\/p>\n<pre>&lt;picker&gt;\n&nbsp;&nbsp;&lt;view&gt;\n&nbsp;&nbsp;{{date}}\n&nbsp;&nbsp;&lt;\/view&gt;&lt;\/picker&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4e09\u3001\u6027\u522b\u9009\u62e9<\/strong><\/p>\n<pre>&lt;picker&gt;\n&nbsp;&nbsp;&lt;view&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;{{gender[index]}}\n&nbsp;&nbsp;&lt;\/view&gt;&lt;\/picker&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u90fd\u9700\u8981\u5728.js\u91cc\u8bbe\u7f6e\u76f8\u5173\u521d\u59cb\u53d8\u91cf\uff01<\/p>\n<pre>var&nbsp;app&nbsp;=&nbsp;getApp();\n&nbsp;data:&nbsp;{\n&nbsp;&nbsp;region:['\u6e56\u5357','\u957f\u6c99','\u5cb3\u9e93'],\n&nbsp;&nbsp;date:'2010-10-10',\n&nbsp;&nbsp;gender:['\u7537','\u5973'],\n&nbsp;&nbsp;index:0\n&nbsp;}\n&nbsp;bindViewEvent:function(e){\n&nbsp;&nbsp;app.process(this,e);&nbsp;&nbsp;\n&nbsp;}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u76f8\u5173js\u7c7b<\/p>\n<pre>\/\/component.js\nconst&nbsp;select&nbsp;=&nbsp;require('..\/component\/select.js');\nconst&nbsp;upload&nbsp;=&nbsp;require('..\/component\/upload.js');\nclass&nbsp;component{\n&nbsp;constructor(com,&nbsp;that)&nbsp;{\n&nbsp;&nbsp;this.com&nbsp;=&nbsp;com;\n&nbsp;&nbsp;this.that&nbsp;=&nbsp;that;\n&nbsp;}\n&nbsp;\/\/\u7ed1\u5b9a\u4e0b\u62c9\u6846\u9009\u62e9\u4e8b\u4ef6\n&nbsp;bindSelect(data){\n&nbsp;&nbsp;let&nbsp;self&nbsp;=&nbsp;this;\n&nbsp;&nbsp;let&nbsp;mode&nbsp;=&nbsp;data.currentTarget.dataset.mode;\n&nbsp;&nbsp;let&nbsp;name&nbsp;=&nbsp;data.currentTarget.dataset.name;\n&nbsp;&nbsp;let&nbsp;picker&nbsp;=&nbsp;new&nbsp;select({\n&nbsp;&nbsp;&nbsp;that:&nbsp;self.that,\n&nbsp;&nbsp;&nbsp;mode:&nbsp;mode,\n&nbsp;&nbsp;&nbsp;name:&nbsp;name\n&nbsp;&nbsp;});\n&nbsp;&nbsp;picker.change(data.detail.value);\n&nbsp;}\n&nbsp;\/\/\u70b9\u51fb\u4e8b\u4ef6\uff0c\u4f20\u9012\u53c2\u6570\u4e3ae.currentTarget.dataset\n&nbsp;bindImageChoose(data){\n&nbsp;&nbsp;\/\/\u56fe\u7247\u4e0a\u4f20\n&nbsp;&nbsp;this.uploader&nbsp;=&nbsp;new&nbsp;upload({\n&nbsp;&nbsp;&nbsp;that:&nbsp;that,\n&nbsp;&nbsp;&nbsp;name:&nbsp;data.name,\n&nbsp;&nbsp;&nbsp;mode:&nbsp;data.mode,\n&nbsp;&nbsp;&nbsp;count:&nbsp;data.count&nbsp;||&nbsp;9\n&nbsp;&nbsp;});\n&nbsp;&nbsp;this.uploader.choose();\n&nbsp;}\n&nbsp;bindImageDel(data){\n&nbsp;&nbsp;\/\/\u56fe\u7247\u4e0a\u4f20\n&nbsp;&nbsp;this.uploader&nbsp;=&nbsp;new&nbsp;upload({\n&nbsp;&nbsp;&nbsp;that:&nbsp;that,\n&nbsp;&nbsp;&nbsp;name:&nbsp;data.name,\n&nbsp;&nbsp;&nbsp;mode:&nbsp;data.mode,\n&nbsp;&nbsp;&nbsp;count:&nbsp;data.count&nbsp;||&nbsp;9\n&nbsp;&nbsp;});\n&nbsp;&nbsp;this.uploader.del(data.index);\n&nbsp;}\n}\nmodule.exports&nbsp;=&nbsp;component;\n\/\/select.js\n\/*\n*&nbsp;\u4e0b\u62c9\u6846\u5bf9\u8c61\n*\/\nclass&nbsp;picker{\n&nbsp;constructor(data){\n&nbsp;&nbsp;this.that&nbsp;=&nbsp;data.that;\n&nbsp;&nbsp;this.name&nbsp;=&nbsp;data.name&nbsp;||&nbsp;'date';\n&nbsp;&nbsp;this.mode&nbsp;=&nbsp;data.mode&nbsp;||&nbsp;'selector';\n&nbsp;}\n&nbsp;show(name,data){\n&nbsp;&nbsp;let&nbsp;view&nbsp;=&nbsp;{};\n&nbsp;&nbsp;view[name]&nbsp;=&nbsp;data;\n&nbsp;&nbsp;this.that.setData(view);\n&nbsp;}\n&nbsp;change(data){\n&nbsp;&nbsp;let&nbsp;self&nbsp;=&nbsp;this;\n&nbsp;&nbsp;self.show(self.name,&nbsp;data);\n&nbsp;}\n}\nmodule.exports&nbsp;=&nbsp;picker;\n\/\/upload.js\nclass&nbsp;picUploader&nbsp;{\n&nbsp;constructor(data)&nbsp;{\n&nbsp;&nbsp;this.that&nbsp;=&nbsp;data.that;\n&nbsp;&nbsp;this.name&nbsp;=&nbsp;data.name;\n&nbsp;&nbsp;this.mode&nbsp;=&nbsp;data.mode&nbsp;||&nbsp;1;\n&nbsp;&nbsp;this.count&nbsp;=&nbsp;this.model&nbsp;==&nbsp;1&nbsp;?&nbsp;1&nbsp;:&nbsp;data.count&nbsp;||&nbsp;9;\n&nbsp;}\n&nbsp;\/*\n&nbsp;*&nbsp;\u9009\u62e9\u56fe\u7247\n&nbsp;*\/\n&nbsp;choose()&nbsp;{\n&nbsp;&nbsp;const&nbsp;self&nbsp;=&nbsp;this;\n&nbsp;&nbsp;wx.chooseImage({\n&nbsp;&nbsp;&nbsp;count:&nbsp;(self.count&nbsp;-&nbsp;self.that.data[self.name].length),\n&nbsp;&nbsp;&nbsp;sizeType:&nbsp;['original',&nbsp;'compressed'],\n&nbsp;&nbsp;&nbsp;sourceType:&nbsp;['album',&nbsp;'camera'],\n&nbsp;&nbsp;&nbsp;success:&nbsp;function&nbsp;(res)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;tempFilePaths&nbsp;=&nbsp;res.tempFilePaths;\n&nbsp;&nbsp;&nbsp;&nbsp;self.append(tempFilePaths);\n&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;})\n&nbsp;}\n&nbsp;\/*\n&nbsp;*&nbsp;\u663e\u793a\u56fe\u7247\n&nbsp;*\/\n&nbsp;show()&nbsp;{\n&nbsp;&nbsp;let&nbsp;self&nbsp;=&nbsp;this;\n&nbsp;&nbsp;let&nbsp;view&nbsp;=&nbsp;{};\n&nbsp;&nbsp;view[self.name]&nbsp;=&nbsp;self.that.data[self.name];\n&nbsp;&nbsp;self.that.setData(view);\n&nbsp;}\n&nbsp;\/*\n&nbsp;*&nbsp;\u8ffd\u52a0\u56fe\u7247\n&nbsp;*\/\n&nbsp;append(data)&nbsp;{\n&nbsp;&nbsp;const&nbsp;self&nbsp;=&nbsp;this;\n&nbsp;&nbsp;for&nbsp;(let&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;p&gt;\t\t&lt;\/p&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e0b\u62c9\u6846\u7ec4\u4ef6\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\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e0b\u62c9\u6846\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5199\u7684\u5341\u5206\u7684\u5168\u9762\u7ec6\u81f4\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u5bf9\u6b64\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u5b66\u4e60\u4e0b\u3002\u5982\u6709\u4e0d\u8db3\u4e4b\u5904\uff0c\u6b22\u8fce\u6279\u8bc4\u6307\u6b63\u3002\u3010\u63a8\u8350\u6559\u7a0b\uff1a\u3011 \u9002\u7528\u573a\u666f 1\u3001\u7701\u5e02\u4e09\u7ea7\u8054\u52a82\u3001\u51fa\u751f\u65e5\u671f\u9009\u62e93\u3001\u6027\u522b\u9009\u62e94\u3001\u4e00\u822c\u6027\u7684\u4e0b\u62c9\u9009\u62e9\u7b49 \u4e00\u3001\u7701\u5e02\u4e09\u7ea7\u8054\u52a8\u4f7f\u7528 \u6ce8\u610fmode = region\uff0c\u4ee5\u53cavalue = \u201c\u4e00\u7ef4\u6570\u7ec4\u201d \/\/.wxml &lt;picker data-method=&#8221;bindSelect&#8221;&gt;&lt;view&gt; &nbsp;&nbsp;&nbsp;\u5f53\u524d\u9009\u62e9\uff1a{{region[0]}}\uff0c{{region[1]}}\uff0c{{region[2]}} &lt;\/view&gt;&lt;\/picker&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e8c\u3001\u51fa\u751f\u65e5\u671f\u9009\u62e9 \u6ce8\u610fmode = date\uff0c\u4ee5\u53cavalue = \u201c\u65e5\u671f\u5b57\u7b26\u4e32\u201d &lt;picker&gt; &nbsp;&nbsp;&lt;view&gt; &nbsp;&nbsp;{{date}} &nbsp;&nbsp;&lt;\/view&gt;&lt;\/picker&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e09\u3001\u6027\u522b\u9009\u62e9 &lt;picker&gt; &nbsp;&nbsp;&lt;view&gt; &nbsp;&nbsp;&nbsp;&nbsp;{{gender[index]}} &nbsp;&nbsp;&lt;\/view&gt;&lt;\/picker&gt; \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u90fd\u9700\u8981\u5728.js\u91cc\u8bbe\u7f6e\u76f8\u5173\u521d\u59cb\u53d8\u91cf\uff01 var&nbsp;app&nbsp;=&nbsp;getApp(); &nbsp;data:&nbsp;{ &nbsp;&nbsp;region:[&#8216;\u6e56\u5357&#8217;,&#8217;\u957f\u6c99&#8217;,&#8217;\u5cb3\u9e93&#8217;], &nbsp;&nbsp;date:&#8217;2010-10-10&#8242;, &nbsp;&nbsp;gender:[&#8216;\u7537&#8217;,&#8217;\u5973&#8217;], &nbsp;&nbsp;index:0 &nbsp;} &nbsp;bindViewEvent:function(e){ &nbsp;&nbsp;app.process(this,e);&nbsp;&nbsp; &nbsp;} \u767b\u5f55\u540e\u590d\u5236 \u76f8\u5173js\u7c7b \/\/component.js const&nbsp;select&nbsp;=&nbsp;require(&#8216;..\/component\/select.js&#8217;); const&nbsp;upload&nbsp;=&nbsp;require(&#8216;..\/component\/upload.js&#8217;); class&nbsp;component{ &nbsp;constructor(com,&nbsp;that)&nbsp;{ &nbsp;&nbsp;this.com&nbsp;=&nbsp;com; &nbsp;&nbsp;this.that&nbsp;=&nbsp;that; &nbsp;} &nbsp;\/\/\u7ed1\u5b9a\u4e0b\u62c9\u6846\u9009\u62e9\u4e8b\u4ef6 &nbsp;bindSelect(data){ [&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-32524","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32524","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=32524"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32524\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=32524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=32524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=32524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}