{"id":31595,"date":"2024-11-25T08:52:41","date_gmt":"2024-11-25T00:52:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31595\/"},"modified":"2024-11-25T08:52:41","modified_gmt":"2024-11-25T00:52:41","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%81%9a%e5%87%ba%e5%9f%8e%e5%b8%82%e9%80%89%e6%8b%a9","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31595\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u505a\u51fa\u57ce\u5e02\u9009\u62e9"},"content":{"rendered":"<p style=\"text-align: left\">\u8fd9\u6b21\u7ed9\u5927\u5bb6\u5e26\u6765\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u505a\u51fa\u57ce\u5e02\u9009\u62e9\uff0c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u505a\u51fa\u57ce\u5e02\u9009\u62e9\u7684\u6ce8\u610f\u4e8b\u9879\u6709\u54ea\u4e9b\uff0c\u4e0b\u9762\u5c31\u662f\u5b9e\u6218\u6848\u4f8b\uff0c\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u3002<\/p>\n<p style=\"text-align: left\">\u672c\u6587\u5b9e\u4f8b\u4e3a\u5927\u5bb6\u5206\u4eab\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u57ce\u5e02\u9009\u62e9\u5668\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\uff0c\u5177\u4f53\u5185\u5bb9\u5982\u4e0b<\/p>\n<p style=\"text-align: left\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/002\/881d72a323e0ab4500aa23dc756d2bf4-0.gif\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u505a\u51fa\u57ce\u5e02\u9009\u62e9\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u505a\u51fa\u57ce\u5e02\u9009\u62e9\u63d2\u56fe\" \/><\/p>\n<p style=\"text-align: left\">\u4ee3\u7801\u5f88\u7b80\u5355.<\/p>\n<pre>var city = require('..\/..\/utils\/city.js');\nvar app = getApp()\nPage({\n data: {\n searchLetter: [],\n showLetter: \"\",\n winHeight: 0,\n \/\/ tHeight: 0,\n \/\/ bHeight: 0,\n cityList: [],\n isShowLetter: false,\n scrollTop: 0,\/\/\u7f6e\u9876\u9ad8\u5ea6\n scrollTopId: '',\/\/\u7f6e\u9876id\n city: \"\u4e0a\u6d77\u5e02\",\n hotcityList: [{ cityCode: 110000, city: '\u5317\u4eac\u5e02' }, { cityCode: 310000, city: '\u4e0a\u6d77\u5e02' }, { cityCode: 440100, city: '\u5e7f\u5dde\u5e02' }, { cityCode: 440300, city: '\u6df1\u5733\u5e02' }, { cityCode: 330100, city: '\u676d\u5dde\u5e02' }, { cityCode: 320100, city: '\u5357\u4eac\u5e02' }, { cityCode: 420100, city: '\u6b66\u6c49\u5e02' }, { cityCode: 410100, city: '\u90d1\u5dde\u5e02' }, { cityCode: 120000, city: '\u5929\u6d25\u5e02' }, { cityCode: 610100, city: '\u897f\u5b89\u5e02' }, { cityCode: 510100, city: '\u6210\u90fd\u5e02' }, { cityCode: 500000, city: '\u91cd\u5e86\u5e02' }]\n },\n onLoad: function () {\n \/\/ \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u52a0\u8f7d\n var searchLetter = city.searchLetter;\n var cityList = city.cityList();\n var sysInfo = wx.getSystemInfoSync();\n var winHeight = sysInfo.windowHeight;\n var itemH = winHeight \/ searchLetter.length;\n var tempObj = [];\n for (var i = 0; i &lt; searchLetter.length; i++) {\n  var temp = {};\n  temp.name = searchLetter[i];\n  temp.tHeight = i * itemH;\n  temp.bHeight = (i + 1) * itemH;\n  tempObj.push(temp)\n }\n this.setData({\n  winHeight: winHeight,\n  itemH: itemH,\n  searchLetter: tempObj,\n  cityList: cityList\n })\n },\n onReady: function () {\n \/\/ \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u521d\u6b21\u6e32\u67d3\u5b8c\u6210\n },\n onShow: function () {\n \/\/ \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u663e\u793a\n },\n onHide: function () {\n \/\/ \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u9690\u85cf\n },\n onUnload: function () {\n \/\/ \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u5378\u8f7d\n },\n onPullDownRefresh: function () {\n \/\/ \u9875\u9762\u76f8\u5173\u4e8b\u4ef6\u5904\u7406\u51fd\u6570--\u76d1\u542c\u7528\u6237\u4e0b\u62c9\u52a8\u4f5c\n },\n onReachBottom: function () {\n \/\/ \u9875\u9762\u4e0a\u62c9\u89e6\u5e95\u4e8b\u4ef6\u7684\u5904\u7406\u51fd\u6570\n },\n clickLetter: function (e) {\n console.log(e.currentTarget.dataset.letter)\n var showLetter = e.currentTarget.dataset.letter;\n this.setData({\n  showLetter: showLetter,\n  isShowLetter: true,\n  scrollTopId: showLetter,\n })\n var that = this;\n setTimeout(function () {\n  that.setData({\n  isShowLetter: false\n  })\n }, 1000)\n },\n \/\/\u9009\u62e9\u57ce\u5e02\n bindCity: function (e) {\n console.log(\"bindCity\")\n this.setData({ city: e.currentTarget.dataset.city })\n },\n \/\/\u9009\u62e9\u70ed\u95e8\u57ce\u5e02\n bindHotCity: function (e) {\n console.log(\"bindHotCity\")\n this.setData({\n  city: e.currentTarget.dataset.city\n })\n },\n \/\/\u70b9\u51fb\u70ed\u95e8\u57ce\u5e02\u56de\u5230\u9876\u90e8\n hotCity: function () {\n this.setData({\n  scrollTop: 0,\n })\n }\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\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<\/p>\n<p>\u63a8\u8350\u9605\u8bfb\uff1a<\/p>\n<p style=\"text-align: left\"><\/p>\n<p style=\"text-align: left\"><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u505a\u51fa\u57ce\u5e02\u9009\u62e9\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\u6b21\u7ed9\u5927\u5bb6\u5e26\u6765\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u600e\u6837\u505a\u51fa\u57ce\u5e02\u9009\u62e9\uff0c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u505a\u51fa\u57ce\u5e02\u9009\u62e9\u7684\u6ce8\u610f\u4e8b\u9879\u6709\u54ea\u4e9b\uff0c\u4e0b\u9762\u5c31\u662f\u5b9e\u6218\u6848\u4f8b\uff0c\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u3002 \u672c\u6587\u5b9e\u4f8b\u4e3a\u5927\u5bb6\u5206\u4eab\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u57ce\u5e02\u9009\u62e9\u5668\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\uff0c\u5177\u4f53\u5185\u5bb9\u5982\u4e0b \u4ee3\u7801\u5f88\u7b80\u5355. var city = require(&#8216;..\/..\/utils\/city.js&#8217;); var app = getApp() Page({ data: { searchLetter: [], showLetter: &#8220;&#8221;, winHeight: 0, \/\/ tHeight: 0, \/\/ bHeight: 0, cityList: [], isShowLetter: false, scrollTop: 0,\/\/\u7f6e\u9876\u9ad8\u5ea6 scrollTopId: &#8221;,\/\/\u7f6e\u9876id city: &#8220;\u4e0a\u6d77\u5e02&#8221;, hotcityList: [{ cityCode: 110000, city: &#8216;\u5317\u4eac\u5e02&#8217; }, { cityCode: 310000, city: &#8216;\u4e0a\u6d77\u5e02&#8217; }, { cityCode: 440100, city: &#8216;\u5e7f\u5dde\u5e02&#8217; }, [&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-31595","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31595","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=31595"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31595\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}