{"id":31570,"date":"2024-11-25T14:19:21","date_gmt":"2024-11-25T06:19:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31570\/"},"modified":"2024-11-25T14:19:21","modified_gmt":"2024-11-25T06:19:21","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%bc%80%e5%8f%91%e4%b8%ad%e6%80%8e%e6%a0%b7%e5%ae%9e%e7%8e%b0%e5%9c%b0%e5%9d%80%e9%a1%b5%e9%9d%a2%e4%b8%89%e7%ba%a7%e8%81%94%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31570\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8"},"content":{"rendered":"<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: left;font-family:\"><span style=\"font-size: 14px\">\u6211\u9047\u5230\u7684\u95ee\u9898\u662f<\/span><\/p>\n<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: justify;font-family:\"><\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/5\/29\/163aa02a0f83cf57?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe\" \/><\/p>\n<p style=\"text-align: left\"><\/p>\n<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: justify;font-family:\"><\/p>\n<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: justify;font-family:\"><span style=\"font-size: 14px\">\u540e\u7aef\u7ed9\u6211\u7684\u6570\u636e\u91cc\u9762\u6709\u6bcf\u4e00\u4e2a\u5730\u5740\u5bf9\u5e94\u7684ID\uff0c\u6bd4\u5982\u5317\u4eac\uff1a2 \u5317\u4eac\uff1a50 \u4e1c\u57ce\u533a\uff1a500<\/span><\/p>\n<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: justify;font-family:\"><span style=\"font-size: 14px\">\u5904\u7406\u8fd9\u4e2a\u6570\u636e\u7684\u65f6\u5019\uff0c\u6211\u6839\u636e\u539f\u6765\u5927\u795e\u7684\u4ee3\u7801\u505a\u4e86\u4e00\u4e9b\u4fee\u6539\uff0c<\/span><\/p>\n<pre>&lt;span style=\"font-size: 14px;\"&gt;&lt;span class=\"hljs-built_in\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(79, 79, 79); word-break: break-all;\"&gt;let&lt;\/span&gt; val = e.detail.value,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;t = this.data.values,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cityData = this.data.cityData,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;index = this.data.id,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list = this.data.addrList;\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].area = &lt;span class=\"hljs-literal\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(0, 102, 102); word-break: break-all;\"&gt;true&lt;\/span&gt;;\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;span class=\"hljs-keyword\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(0, 0, 136); word-break: break-all;\"&gt;if&lt;\/span&gt; (val[0] != t[0]) { \/\/\u5f53val\u662f\u9009\u62e9\u7701\u4efd\u7684\u65f6\u5019\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const citys = [];\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const countys = [];\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cityData[val[0]].child.map(item =&amp;gt; citys.push({name:item.name,id:item.id}));\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cityData[val[0]].child[0].child.map(item =&amp;gt; countys.push({name:item.name,id:item.id}));\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].provinceName = this.data.provinces[val[0]].name;\/\/\u7701\u4efd\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].cityName = cityData[val[0]].child[0].name;\/\/\u57ce\u5e02\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].districtName = cityData[val[0]].child[0].child[0].name;\/\/\u5730\u533a\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].province = this.data.provinces[val[0]].id;\/\/\u5bf9\u5e94\u7684\u4f20\u503cID\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].city = cityData[val[0]].child[0].id;\/\/\u5bf9\u5e94\u7684\u4f20\u503cID\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].district = cityData[val[0]].child[0].child[0].id;\/\/\u5bf9\u5e94\u7684\u4f20\u503cID\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.setData({\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;citys: citys,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;countys: countys,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;values: val,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;value: [val[0], 0, 0],\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addrList: list\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;span class=\"hljs-built_in\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(79, 79, 79); word-break: break-all;\"&gt;return&lt;\/span&gt;;\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;span class=\"hljs-keyword\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(0, 0, 136); word-break: break-all;\"&gt;if&lt;\/span&gt; (val[1] != t[1]) {\/\/\u5f53val\u662f\u9009\u62e9\u57ce\u5e02\u7684\u65f6\u5019\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const countys = [];\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cityData[val[0]].child[val[1]].child.map(item =&amp;gt; countys.push({name:item.name,id:item.id}));\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].cityName = this.data.citys[val[1]].name;\/\/ \u9009\u62e9\u57ce\u5e02\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].city = this.data.citys[val[1]].id;\/\/\u5bf9\u5e94\u7684\u4f20\u503cID\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].districtName = cityData[val[0]].child[val[1]].child[0].name;\/\/\u9009\u62e9\u57ce\u5e02\u5bf9\u5e94\u7684\u5730\u533a\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].district = cityData[val[0]].child[val[1]].child[0].id;\/\/\u5bf9\u5e94\u7684\u4f20\u503cID\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.setData({\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;countys: countys,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;values: val,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;value: [val[0], val[1], 0],\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addrList: list\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;span class=\"hljs-built_in\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(79, 79, 79); word-break: break-all;\"&gt;return&lt;\/span&gt;;\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;span class=\"hljs-keyword\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(0, 0, 136); word-break: break-all;\"&gt;if&lt;\/span&gt; (val[2] != t[2]) {\/\/\u5f53val\u662f\u9009\u62e9\u5730\u533a\u7684\u65f6\u5019\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].districtName = this.data.countys[val[2]].name;\/\/\u9009\u62e9\u5730\u533a\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list[index].district = this.data.countys[val[2]].id;\/\/\u5bf9\u5e94\u7684\u4f20\u503cID\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.setData({\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;county: this.data.countys[val[2]].name,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;values: val,\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addrList: list\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;span class=\"hljs-built_in\" style=\"font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(79, 79, 79); word-break: break-all;\"&gt;return&lt;\/span&gt;;\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp;\n\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} catch(e) {\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ statements\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(e);\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}\nlist\u91cc\u9762\u662f\u6709 \u6536\u8d27\u4eba\uff0c\u7535\u8bdd\uff0c\u7b49\u7b49\u4fe1\u606f &nbsp;\u4f46\u662f\u6211\u53ea\u64cd\u4f5c\u6539\u53d8\u6570\u7ec4\u91cc\u9762\u5730\u5740\u6539\u53d8\u7684\u4fe1\u606f\uff0c&lt;\/span&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236<br \/>\n<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/5\/29\/163aa02a1a8db5ac?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe1\" \/> <\/p>\n<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: justify;font-family:\"><span style=\"font-size: 14px\">\u5e03\u5c40\u65b9\u9762\u9700\u8981\u505a\u4e00\u4e9b\u4fee\u6539\u7684\u5730\u65b9\u5c31\u662f<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/5\/29\/163aa02a1d718773?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe2\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe2\" \/><br \/>\n<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/user-gold-cdn.xitu.io\/2018\/5\/29\/163aa02a1de1d81b?imageView2\/0\/w\/1280\/h\/960\/format\/webp\/ignore-error\/1\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe3\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\u63d2\u56fe3\" \/> <\/p>\n<p><span style=\"font-size: 14px\">\u76f8\u4fe1\u770b\u4e86\u672c\u6587\u6848\u4f8b\u4f60\u5df2\u7ecf\u638c\u63e1\u4e86\u65b9\u6cd5\uff0c\u66f4\u591a\u7cbe\u5f69\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/span><\/p>\n<p><span style=\"font-size: 14px\">\u63a8\u8350\u9605\u8bfb\uff1a<\/span><\/p>\n<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: justify;font-family:\"><\/p>\n<p style=\"padding: 0px;margin-top: 0px;margin-bottom: 16px;font-size: 20px;line-height: 26px;text-align: justify;font-family:\"><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u5b9e\u73b0\u5730\u5740\u9875\u9762\u4e09\u7ea7\u8054\u52a8\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>\u6211\u9047\u5230\u7684\u95ee\u9898\u662f \u540e\u7aef\u7ed9\u6211\u7684\u6570\u636e\u91cc\u9762\u6709\u6bcf\u4e00\u4e2a\u5730\u5740\u5bf9\u5e94\u7684ID\uff0c\u6bd4\u5982\u5317\u4eac\uff1a2 \u5317\u4eac\uff1a50 \u4e1c\u57ce\u533a\uff1a500 \u5904\u7406\u8fd9\u4e2a\u6570\u636e\u7684\u65f6\u5019\uff0c\u6211\u6839\u636e\u539f\u6765\u5927\u795e\u7684\u4ee3\u7801\u505a\u4e86\u4e00\u4e9b\u4fee\u6539\uff0c &lt;span style=&#8221;font-size: 14px;&#8221;&gt;&lt;span class=&#8221;hljs-built_in&#8221; style=&#8221;font-size: 14px; box-sizing: border-box; outline: 0px; color: rgb(79, 79, 79); word-break: break-all;&#8221;&gt;let&lt;\/span&gt; val = e.detail.value, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;t = this.data.values, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cityData = this.data.cityData, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;index = this.data.id, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;list = [&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-31570","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31570","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=31570"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31570\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}