{"id":33407,"date":"2024-11-25T10:27:51","date_gmt":"2024-11-25T02:27:51","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33407\/"},"modified":"2024-11-25T10:27:51","modified_gmt":"2024-11-25T02:27:51","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%9c%81%e5%b8%82%e8%81%94%e5%8a%a8%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33407\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd"},"content":{"rendered":"<p>\u6700\u8fd1\u5462\u521a\u597d\u505a\u4e86\u4e00\u4e2a\u7701\u5e02\u8054\u52a8\u7684\u529f\u80fd\uff0c\u4eca\u5929\u770b\u5230\u6709\u4eba\u95ee\u8fd9\u4e2a\u600e\u4e48\u505a\uff0c\u6211\u5c31\u628a\u6211\u505a\u7684\u653e\u4e0a\u6765\u5171\u4eab\u4e00\u4e0b\uff1a<\/p>\n<p>\u9996\u5148\u5462\uff0c\u6765\u770b\u770b\u6548\u679c\uff0c\u70b9\u51fb\u6587\u5b57\u2018\u70b9\u51fb\u2019\uff0c\u5f39\u51fa\u9009\u62e9\u7a97\u53e3\uff0c\u70b9\u51fb\u53d6\u6d88\u6216\u8005\u786e\u5b9a\uff08\u53d6\u6d88\u3001\u786e\u5b9a\u6309\u94ae\u5728\u9009\u62e9\u6846\u4e0a\u8fb9\uff0c\u622a\u56fe\u6709\u4e9b\u4e0d\u6e05\u695a\uff09\uff0c\u7a97\u53e3\u4e0b\u6ed1\uff0c<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/051\/8ea8d6ccb5b8acf7ff49ae452813ed37-0.gif\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd\u63d2\u56fe\" \/><\/p>\n<p>\u505a\u8fd9\u4e2a\u6211\u7528\u7684\u662fpicker-view\u8fd9\u4e2a\u7ec4\u4ef6\uff0c\u73b0\u5728\u6765\u770b\u4e00\u770bpicker-view\u7684\u5c5e\u6027\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/051\/342a28026969bd631d5a5146a5b7b04b-1.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd\u63d2\u56fe1\" \/><\/p>\n<p>\u73b0\u5728\u5f00\u59cb\u5199wxml\u7684\u4ee3\u7801\uff0c\u5bf9\u4e86\uff0c\u63d2\u4e00\u53e5\uff0c\u6211\u8fd9\u91cc\u662f\u628a\u5b83\u5199\u6210\u4e00\u4e2a\u6a21\u677f\u7684\uff0c\u5148\u770b\u770b\u76ee\u5f55\u7ed3\u6784<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/051\/d26acd523ab72cb7412bd3f62494d087-2.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd\u63d2\u56fe2\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd\u63d2\u56fe2\" \/><\/p>\n<p>\u6211\u4eec\u5148\u6765\u770b\u770b<strong>cascade.wxml<\/strong>\u91cc\u7684\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;template name=\"cascade\"&gt;\n  &lt;view class=\"cascade_box\" animation=\"{{animationData}}\"&gt;\n  &lt;view class=\"cascade_hei\"&gt;&lt;\/view&gt;\n   &lt;view class=\"cascade_find\"&gt;\n        &lt;view class=\"cascade_header\"&gt;\n            &lt;text class='quxiao' catchtap=\"quxiao\"&gt;\u53d6\u6d88&lt;\/text&gt;\n            &lt;text class=\"queren\" catchtap=\"queren\"&gt;\u786e\u8ba4&lt;\/text&gt;\n        &lt;\/view&gt;\n        &lt;picker-view indicator-style=\"height: 80rpx;\" style=\"width: 100%; height: 400rpx;\" bindchange=\"bindChange\"&gt;\n            &lt;picker-view-column&gt;\n            &lt;view wx:for=\"{{sheng}}\" wx:key='this' style=\"line-height: 80rpx;text-align:center;\"&gt;{{item}}&lt;\/view&gt;\n            &lt;\/picker-view-column&gt;\n            &lt;picker-view-column&gt;\n            &lt;view wx:for=\"{{shi}}\" wx:key='this' style=\"line-height: 80rpx;text-align:center;\"&gt;{{item}}&lt;\/view&gt;\n            &lt;\/picker-view-column&gt;\n            &lt;picker-view-column&gt;\n            &lt;view wx:for=\"{{qu}}\" wx:key='this' style=\"line-height: 80rpx;text-align:center;\"&gt;{{item}}&lt;\/view&gt;\n            &lt;\/picker-view-column&gt;\n        &lt;\/picker-view&gt;\n    &lt;\/view&gt;\n&lt;\/view&gt;\n&lt;\/template&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63a5\u4e0b\u6765\u662f<strong>cascade.wxss<\/strong>\u7684\u4ee3\u7801\uff1a<\/p>\n<pre>.cascade_box{\n    font-size:28rpx;\n    width: 100%;\n    height: 0;\n    position: fixed;\n    bottom: 0;\n    left: 0;\n}\n.cascade_hei{\n    width: 100%;\n    height:732rpx;\n    background: #000;\n    opacity: 0.5;\n}\n.cascade_find{\n    width: 100%;\n    height: 500rpx;\n    position: relative;    \/*bottom: 0;\n    left: 0;*\/\n    background: #fff;\n}\n\n.quxiao,.queren{\n    display: block;\n    position: absolute;\n    width: 100rpx;\n    height: 80rpx;\n    line-height: 80rpx;    \/*background: #00f;*\/\n    text-align: center;\n    color: #0f0;\n}\n.queren{\n    right: 0;\n    top: 0;\n}\n.cascade_header{\n    height: 80rpx;\n    width: 100%;\n    margin-bottom: 20rpx;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u597d\u4e86\u8fd9\u91cc\u7684\u6a21\u677f\u5199\u597d\u4e86\uff0c\u63a5\u4e0b\u6765\u662f\u5f15\u7528\uff0c\u5f15\u7528\u5c31\u5f88\u7b80\u5355\u4e86\uff1a<\/p>\n<p>\u9996\u5148\u662f<strong>las.wxml<\/strong>\u7684\u5f15\u7528\uff1a<\/p>\n<pre>&lt;span style=\"font-size: 14px;\"&gt;&lt;import src=\"..\/..\/teml\/cascade.wxml\"\/&gt;\n&lt;view bindtap=\"dianji\"&gt;\u70b9\u51fb&lt;\/view&gt;&lt;br\/&gt;&lt;view&gt;&lt;br\/&gt;\u3000\u3000&lt;text&gt;\u7701\uff1a{{jieguo.sheng}}&lt;\/text&gt;&lt;br\/&gt;\u3000\u3000&lt;text&gt;\u5e02\uff1a{{jieguo.shi}}&lt;\/text&gt;&lt;br\/&gt;\u3000\u3000&lt;text&gt;\u533a\uff1a{{jieguo.qu}}&lt;\/text&gt;&lt;br\/&gt;&lt;\/view&gt;\n&lt;template is=\"cascade\" data=\"{{animationData:animationData,sheng:sheng,shi:shi,qu:qu}}\"\/&gt;&lt;\/span&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u662f<strong>las.wxss<\/strong>\u7684\u5f15\u7528\uff08\u4f60\u6ca1\u770b\u9519\u5c31\u662f\u4e00\u53e5\uff09\uff1a<\/p>\n<pre>@import '..\/..\/teml\/cascade.wxss';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63a5\u4e0b\u6765\u5c31\u662fJS\u4e86\uff1a<\/p>\n<p>\u5728\u8fd9\u91cc\u8981\u5148\u8bf4\u4e00\u4e0b\u4fdd\u5b58\u7701\u5e02\u7684\u540d\u79f0\u7684json\u6587\u4ef6\u683c\u5f0f\uff0c\u8fd9\u4e2ajson\u6587\u4ef6\u91cc\u53c8\u5168\u56fd\u7684\u7701\u5e02\u540d\u79f0(\u8fd9\u91cc\u53ea\u5199\u4e86\u5317\u4eac\u5e02\u4e3a\u4f8b\u5b50\uff0c\u8fd9\u662f\u6211\u8bf7\u6c42\u7684\u6570\u636e\u7684\u4f8b\u5b50\uff0c\u4f60\u8981\u6839\u636e\u4f60\u81ea\u5df1\u8bf7\u6c42\u7684\u6570\u636e\u6765\u505a\u4e00\u4e9bJS\u7684\u5224\u65ad)\uff1a<\/p>\n<pre>{\n    \"regions\": [{\n        \"id\": 110000,\n        \"name\": \"\u5317\u4eac\",\n        \"regions\": [{\n            \"id\": 110100,\n            \"name\": \"\u5317\u4eac\u5e02\",\n            \"regions\": [{\n                \"id\": 110101,\n                \"name\": \"\u4e1c\u57ce\u533a\"\n            }, {\n                \"id\": 110102,\n                \"name\": \"\u897f\u57ce\u533a\"\n            }, {\n                \"id\": 110103,\n                \"name\": \"\u5d07\u6587\u533a\"\n            }, {\n                \"id\": 110104,\n                \"name\": \"\u5ba3\u6b66\u533a\"\n            }, {\n                \"id\": 110105,\n                \"name\": \"\u671d\u9633\u533a\"\n            }, {\n                \"id\": 110106,\n                \"name\": \"\u4e30\u53f0\u533a\"\n            }, {\n                \"id\": 110107,\n                \"name\": \"\u77f3\u666f\u5c71\u533a\"\n            }, {\n                \"id\": 110108,\n                \"name\": \"\u6d77\u6dc0\u533a\"\n            }, {\n                \"id\": 110109,\n                \"name\": \"\u95e8\u5934\u6c9f\u533a\"\n            }, {\n                \"id\": 110111,\n                \"name\": \"\u623f\u5c71\u533a\"\n            }, {\n                \"id\": 110112,\n                \"name\": \"\u901a\u5dde\u533a\"\n            }, {\n                \"id\": 110113,\n                \"name\": \"\u987a\u4e49\u533a\"\n            }, {\n                \"id\": 110114,\n                \"name\": \"\u660c\u5e73\u533a\"\n            }, {\n                \"id\": 110115,\n                \"name\": \"\u5927\u5174\u533a\"\n            }, {\n                \"id\": 110116,\n                \"name\": \"\u6000\u67d4\u533a\"\n            }, {\n                \"id\": 110117,\n                \"name\": \"\u5e73\u8c37\u533a\"\n            }, {\n                \"id\": 110228,\n                \"name\": \"\u5bc6\u4e91\u53bf\"\n            }, {\n                \"id\": 110229,\n                \"name\": \"\u5ef6\u5e86\u53bf\"\n            }]\n        }],\n        \"pinyin\": \"BeiJing\",\n        \"hot\": true,\n        \"municipality\": true\n    }]}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u91cc\u5c31\u662f\u5bf9\u6570\u636e\u8fdb\u884c\u64cd\u4f5c\u7684<strong>las.js<\/strong>\u4e86<\/p>\n<pre>Page({\n  data: {\n      sheng: [],\/\/\u83b7\u53d6\u5230\u7684\u6240\u6709\u7684\u7701\n      shi: [],\/\/\u9009\u62e9\u7684\u8be5\u7701\u7684\u6240\u6709\u5e02\n      qu: [],\/\/\u9009\u62e9\u7684\u8be5\u5e02\u7684\u6240\u6709\u533a\u53bf\n      sheng_index:0,\/\/picker-view\u7701\u9879\u9009\u62e9\u7684value\u503c\n      shi_index:0,\/\/picker-view\u5e02\u9879\u9009\u62e9\u7684value\u503c\n      qu_index:0,\/\/picker-view\u533a\u53bf\u9879\u9009\u62e9\u7684value\u503c\n      shengshi:null,\/\/\u53d6\u5230\u8be5\u6570\u636e\u7684\u6240\u6709\u7701\u5e02\u533a\u6570\u636e\n      jieguo:{},\/\/\u6700\u540e\u53d6\u5230\u7684\u7701\u5e02\u533a\u540d\u5b57\n      animationData: {}\n  },\n\/\/\u70b9\u51fb\u4e8b\u4ef6\uff0c\u70b9\u51fb\u5f39\u51fa\u9009\u62e9\u9875\n  dianji:function(){\n\u3000\u3000\u3000\u3000\/\/\u8fd9\u91cc\u5199\u4e86\u4e00\u4e2a\u52a8\u753b\uff0c\u8ba9\u5176\u9ad8\u5ea6\u53d8\u4e3a\u6ee1\u5c4f\n      var animation = wx.createAnimation({\n          duration: 500,\n            timingFunction: 'ease',\n        })\n        this.animation = animation\n        animation.height(1332+'rpx').step()\n        this.setData({\n          animationData:animation.export()\n        })\n\n  },\n\/\/\u53d6\u6d88\u6309\u94ae\n  quxiao:function(){\n\u3000\u3000\u3000\u3000\/\/\u8fd9\u91cc\u4e5f\u662f\u52a8\u753b\uff0c\u7136\u5176\u9ad8\u5ea6\u53d8\u4e3a0\n      var animation = wx.createAnimation({\n          duration: 500,\n            timingFunction: 'ease',\n        })\n\n        this.animation = animation\n        animation.height(0+'rpx').step()\n        this.setData({\n          animationData:animation.export()\n        });\n\u3000\u3000\u3000\u3000\/\/\u53d6\u6d88\u4e0d\u4f20\u503c\uff0c\u8fd9\u91cc\u5c31\u628ajieguo \u7684\u503c\u8d4b\u503c\u4e3a{}\n        this.setData({\n            jieguo:{}\n        });\n        console.log(this.data.jieguo);\n  },\n\/\/\u786e\u8ba4\u6309\u94ae\n  queren:function(){\n\u3000\u3000\u3000\/\/\u4e00\u6837\u662f\u52a8\u753b\uff0c\u7ea7\u8054\u9009\u62e9\u9875\u6d88\u5931\uff0c\u6548\u679c\u548c\u53d6\u6d88\u4e00\u6837\n    var animation = wx.createAnimation({\n          duration: 500,\n            timingFunction: 'ease',\n        })\n        this.animation = animation\n        animation.height(0+'rpx').step()\n        this.setData({\n          animationData:animation.export()\n        });\/\/\u6253\u5370\u6700\u540e\u9009\u53d6\u7684\u7ed3\u679c\n      console.log(this.data.jieguo);\n  },\n\/\/\u6eda\u52a8\u9009\u62e9\u7684\u65f6\u5019\u89e6\u53d1\u4e8b\u4ef6\n  bindChange: function(e) {\n\/\/\u8fd9\u91cc\u662f\u83b7\u53d6picker-view\u5185\u7684picker-view-column \u5f53\u524d\u9009\u62e9\u7684\u662f\u7b2c\u51e0\u9879\n\n\u3000const val = e.detail.value\nthis.setData({\n      sheng_index: val[0],\n      shi_index: val[1],\n      qu_index: val[2]\n    })\n    this.jilian();\n    console.log(val);\n    console.log(this.data.jieguo);\n  },\n\/\/\u8fd9\u91cc\u662f\u5224\u65ad\u7701\u5e02\u540d\u79f0\u7684\u663e\u793a\n  jilian:function(){\n     var  that=this,\n          shengshi=that.data.shengshi,\n          sheng=[],\n          shi=[],\n          qu=[],\n          qu_index=that.data.qu_index,\n          shi_index=that.data.shi_index,\n          sheng_index=that.data.sheng_index;\n\u3000\u3000\u3000\u3000\/\/\u904d\u5386\u6240\u6709\u7684\u7701\uff0c\u5c06\u7701\u7684\u540d\u5b57\u5b58\u5230sheng\u8fd9\u4e2a\u6570\u7ec4\u4e2d\n      for (let i =0; i &lt; shengshi.length; i++) {\n          sheng.push(shengshi[i].name)    \n        }\n\n        if(shengshi[sheng_index].regions){\/\/\u8fd9\u91cc\u5224\u65ad\u8fd9\u4e2a\u7701\u7ea7\u91cc\u9762\u6709\u6ca1\u6709\u5e02\uff08\u5982\u6570\u636e\u4e2d\u7684\u9999\u6e2f\u3001\u6fb3\u95e8\u7b49\u5c31\u6ca1\u6709\u5199\u5e02\uff09\n            if(shengshi[sheng_index].regions[shi_index]){\/\/\u8fd9\u91cc\u662f\u5224\u65ad\u8fd9\u4e2a\u9009\u62e9\u7684\u7701\u91cc\u9762\uff0c\u6709\u6ca1\u6709\u76f8\u5e94\u7684\u4e0b\u6807\u4e3ashi_index\u7684\u5e02\uff0c\u56e0\u4e3a\u8fd9\u91cc\u7684\u4e0b\u6807\u662f\u524d\u4e00\u6b21\u9009\u62e9\u540e\u7684\u4e0b\u6807\uff0c\u6bd4\u5982\u4e4b\u524d\u9009\u62e9\u7684\u4e00\u4e2a\u7701\u670910\u4e2a\u5e02\uff0c\u6211\u521a\u597d\u6ed1\u5230\u4e86\u7b2c\u5341\u4e2a\u5e02\uff0c\u73b0\u5728\u53c8\u91cd\u65b0\u9009\u62e9\u4e86\u7701\uff0c\u4f46\u662f\u8fd9\u4e2a\u7701\u6700\u591a\u53ea\u67095\u4e2a\u5e02\uff0c\u4f46\u662f\u8fd9\u65f6\u5019\u7684shi_index\u4e3a9\uff0c\u800c\u8fd9\u91cc\u7684\u5e02\u6839\u672c\u6ca1\u6709\u90a3\u4e48\u591a\uff0c\u6240\u4ee5\u4f1a\u62a5\u9519\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/\u8fd9\u91cc\u5982\u679c\u6709\u8fd9\u4e2a\u5e02\uff0c\u90a3\u4e48\u628a\u9009\u4e2d\u7684\u8fd9\u4e2a\u7701\u4e2d\u7684\u6240\u6709\u7684\u5e02\u7684\u540d\u5b57\u4fdd\u5b58\u5230shi\u8fd9\u4e2a\u6570\u7ec4\u4e2d\n                for(let i=0;i&lt; shengshi[sheng_index].regions.length;i++){\n                    shi.push(shengshi[sheng_index].regions[i].name);\n                }\n                 console.log('\u6267\u884c\u4e86\u533a\u7ea7\u5224\u65ad');\n               \n                if(shengshi[sheng_index].regions[shi_index].regions){\/\/\u8fd9\u91cc\u662f\u5224\u65ad\u9009\u62e9\u7684\u8fd9\u4e2a\u5e02\u5728\u6570\u636e\u91cc\u9762\u6709\u6ca1\u6709\u533a\u53bf\n             if(shengshi[sheng_index].regions[shi_index].regions[qu_index]){\/\/\u8fd9\u91cc\u662f\u5224\u65ad\u9009\u62e9\u7684\u8fd9\u4e2a\u5e02\u91cc\u6709\u6ca1\u6709\u4e0b\u6807\u4e3aqu_index\u7684\u533a\u53bf\uff0c\u9053\u7406\u540c\u4e0a\u9762\u5e02\u7684\u9009\u62e9\n               console.log('\u8fd9\u91cc\u5224\u65ad\u6709\u6ca1\u6709\u8fdb\u533a\u91cc');\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/\u6709\u7684\u8bdd\uff0c\u628a\u9009\u62e9\u7684\u8fd9\u4e2a\u5e02\u91cc\u9762\u7684\u6240\u6709\u7684\u533a\u53bf\u540d\u5b57\u4fdd\u5b58\u5230qu\u8fd9\u4e2a\u6570\u7ec4\u4e2d\n                    for(let i=0;i&lt; shengshi[sheng_index].regions[shi_index].regions.length;i++){\n                      console.log('\u8fd9\u91cc\u662f\u5199\u533a\u5f97');\n                        qu.push(shengshi[sheng_index].regions[shi_index].regions[i].name);\n                     }\n                }else{\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/\u8fd9\u91cc\u548c\u9009\u62e9\u5e02\u7684\u9053\u7406\u4e00\u6837\n                  that.setData({\n                      qu_index:0\n                  });\n                  for(let i=0;i&lt; shengshi[sheng_index].regions[shi_index].regions.length;i++){\n                        qu.push(shengshi[sheng_index].regions[shi_index].regions[i].name);\n                     }\n                }}else{\n\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\/\/\u5982\u679c\u8fd9\u4e2a\u5e02\u91cc\u9762\u6ca1\u6709\u533a\u53bf\uff0c\u90a3\u4e48\u628a\u8fd9\u4e2a\u5e02\u7684\u540d\u5b57\u5c31\u8d4b\u503c\u7ed9qu\u8fd9\u4e2a\u6570\u7ec4\n                  qu.push(shengshi[sheng_index].regions[shi_index].name);\n                }\n            }else{\n\u3000\u3000\u3000\u3000\u3000\u3000\/\/\u5982\u679c\u9009\u62e9\u7684\u7701\u91cc\u9762\u6ca1\u6709\u4e0b\u6807\u4e3ashi_index\u7684\u5e02\uff0c\u90a3\u4e48\u628a\u8fd9\u4e2a\u4e0b\u6807\u7684\u503c\u8d4b\u503c\u4e3a0\uff1b\u7136\u540e\u518d\u628a\u9009\u4e2d\u7684\u8be5\u7701\u7684\u6240\u6709\u7684\u5e02\u7684\u540d\u5b57\u653e\u5230shi\u8fd9\u4e2a\u6570\u7ec4\u4e2d\n              that.setData({\n                  shi_index:0\n              });\n               for(let i=0;i&lt; shengshi[sheng_index].regions.length;i++){\n                    shi.push(shengshi[sheng_index].regions[i].name);\n                }\n                \n            }\n        }else{\n\u3000\u3000\u3000\u3000\u3000\u3000\/\/\u5982\u679c\u8be5\u7701\u7ea7\u6ca1\u6709\u5e02\uff0c\u90a3\u4e48\u5c31\u628a\u7701\u7684\u540d\u5b57\u4f5c\u4e3a\u5e02\u548c\u533a\u7684\u540d\u5b57\n                shi.push(shengshi[sheng_index].name);\n                qu.push(shengshi[sheng_index].name);\n        }\n       \n        console.log(sheng);\n        console.log(shi);\n        console.log(qu);\n        \/\/\u9009\u62e9\u6210\u529f\u540e\u628a\u76f8\u5e94\u7684\u6570\u7ec4\u8d4b\u503c\u7ed9\u76f8\u5e94\u7684\u53d8\u91cf\n        that.setData({\n              sheng: sheng,\n              shi: shi,\n              qu: qu\n        });\n\u3000\u3000\u3000\u3000\/\/\u6709\u65f6\u5019\u7f51\u7edc\u6162\uff0c\u4f1a\u51fa\u73b0\u533a\u53bf\u9009\u62e9\u51fa\u73b0\u7a7a\u767d\uff0c\u8fd9\u91cc\u662f\u5982\u679c\u51fa\u73b0\u7a7a\u767d\u90a3\u4e48\u6267\u884c\u4e00\u6b21\u56de\u8c03\n        if(sheng.length==0||shi.length==0||qu.length==0){\n              that.jilian();\n              console.log('\u8fd9\u91cc\u6267\u884c\u4e86\u56de\u8c03');\n              \/\/ console.log();\n        }\n        console.log(sheng[that.data.sheng_index]);\n        console.log(shi[that.data.shi_index]);\n        console.log(qu[that.data.qu_index]);\n\u3000\u3000\u3000\u3000\/\/\u628a\u9009\u62e9\u7684\u7701\u5e02\u533a\u90fd\u653e\u5230jieguo\u4e2d\n        let jieguo={\n            sheng:sheng[that.data.sheng_index],\n            shi:shi[that.data.shi_index],\n            qu:qu[that.data.qu_index]\n        };\n\u3000\u3000\n        that.setData({\n            jieguo:jieguo\n        });\n\n  },\n  onLoad:function(){\n    var that=this;\n\/\/\u8bf7\u6c42\u7701\u5e02\u533a\u7684\u6570\u636e\n      wx.request({\n        url: 'https:\/\/wxxapp.duapp.com\/quanguo.json',\/\/\u7531\u4e8e\u670d\u52a1\u5668\u5df2\u5173\u95ed\uff0c\u8fd9\u4e2a\u5730\u5740\u5df2\u7ecf\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u7528\u81ea\u5df1\u7684\u6570\u636e\u6765\u5199\n        data: {},\n        method: 'GET', \n        success: function(res){\n          \/\/ success\n\n          console.log(res.data.regions);\n          \/\/ shengshi=res.data.regions\n          that.setData({\n            shengshi:res.data.regions\n          });\n\u3000\u3000\u3000\u3000\u3000\u3000\n          that.jilian();   \n            \n\n            \n        },\n        fail: function() {\n          \/\/ fail\n        },\n        complete: function() {\n          \/\/ complete\n        }\n      })\n  }\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7701\u5e02\u8054\u52a8\u529f\u80fd\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>\u6700\u8fd1\u5462\u521a\u597d\u505a\u4e86\u4e00\u4e2a\u7701\u5e02\u8054\u52a8\u7684\u529f\u80fd\uff0c\u4eca\u5929\u770b\u5230\u6709\u4eba\u95ee\u8fd9\u4e2a\u600e\u4e48\u505a\uff0c\u6211\u5c31\u628a\u6211\u505a\u7684\u653e\u4e0a\u6765\u5171\u4eab\u4e00\u4e0b\uff1a \u9996\u5148\u5462\uff0c\u6765\u770b\u770b\u6548\u679c\uff0c\u70b9\u51fb\u6587\u5b57\u2018\u70b9\u51fb\u2019\uff0c\u5f39\u51fa\u9009\u62e9\u7a97\u53e3\uff0c\u70b9\u51fb\u53d6\u6d88\u6216\u8005\u786e\u5b9a\uff08\u53d6\u6d88\u3001\u786e\u5b9a\u6309\u94ae\u5728\u9009\u62e9\u6846\u4e0a\u8fb9\uff0c\u622a\u56fe\u6709\u4e9b\u4e0d\u6e05\u695a\uff09\uff0c\u7a97\u53e3\u4e0b\u6ed1\uff0c \u505a\u8fd9\u4e2a\u6211\u7528\u7684\u662fpicker-view\u8fd9\u4e2a\u7ec4\u4ef6\uff0c\u73b0\u5728\u6765\u770b\u4e00\u770bpicker-view\u7684\u5c5e\u6027\uff1a \u73b0\u5728\u5f00\u59cb\u5199wxml\u7684\u4ee3\u7801\uff0c\u5bf9\u4e86\uff0c\u63d2\u4e00\u53e5\uff0c\u6211\u8fd9\u91cc\u662f\u628a\u5b83\u5199\u6210\u4e00\u4e2a\u6a21\u677f\u7684\uff0c\u5148\u770b\u770b\u76ee\u5f55\u7ed3\u6784 \u6211\u4eec\u5148\u6765\u770b\u770bcascade.wxml\u91cc\u7684\u4ee3\u7801\uff1a &lt;template name=&#8221;cascade&#8221;&gt; &lt;view class=&#8221;cascade_box&#8221; animation=&#8221;{{animationData}}&#8221;&gt; &lt;view class=&#8221;cascade_hei&#8221;&gt;&lt;\/view&gt; &lt;view class=&#8221;cascade_find&#8221;&gt; &lt;view class=&#8221;cascade_header&#8221;&gt; &lt;text class=&#8217;quxiao&#8217; catchtap=&#8221;quxiao&#8221;&gt;\u53d6\u6d88&lt;\/text&gt; &lt;text class=&#8221;queren&#8221; catchtap=&#8221;queren&#8221;&gt;\u786e\u8ba4&lt;\/text&gt; &lt;\/view&gt; &lt;picker-view indicator-style=&#8221;height: 80rpx;&#8221; style=&#8221;width: 100%; height: 400rpx;&#8221; bindchange=&#8221;bindChange&#8221;&gt; &lt;picker-view-column&gt; &lt;view wx:for=&#8221;{{sheng}}&#8221; wx:key=&#8217;this&#8217; style=&#8221;line-height: 80rpx;text-align:center;&#8221;&gt;{{item}}&lt;\/view&gt; &lt;\/picker-view-column&gt; &lt;picker-view-column&gt; &lt;view wx:for=&#8221;{{shi}}&#8221; wx:key=&#8217;this&#8217; style=&#8221;line-height: 80rpx;text-align:center;&#8221;&gt;{{item}}&lt;\/view&gt; &lt;\/picker-view-column&gt; &lt;picker-view-column&gt; &lt;view wx:for=&#8221;{{qu}}&#8221; wx:key=&#8217;this&#8217; style=&#8221;line-height: 80rpx;text-align:center;&#8221;&gt;{{item}}&lt;\/view&gt; &lt;\/picker-view-column&gt; &lt;\/picker-view&gt; &lt;\/view&gt; &lt;\/view&gt; [&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-33407","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33407","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=33407"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33407\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}