{"id":42,"date":"2024-06-25T16:27:26","date_gmt":"2024-06-25T08:27:26","guid":{"rendered":"https:\/\/a.li6.cc\/?p=42"},"modified":"2024-06-25T16:27:35","modified_gmt":"2024-06-25T08:27:35","slug":"fastadmin-citypicker-%e8%ae%be%e7%bd%ae%e7%9b%91%e5%90%ac%ef%bc%8c%e8%87%aa%e5%ae%9a%e4%b9%89%e6%a0%b7%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/a.li6.cc\/index.php\/2024\/06\/25\/fastadmin-citypicker-%e8%ae%be%e7%bd%ae%e7%9b%91%e5%90%ac%ef%bc%8c%e8%87%aa%e5%ae%9a%e4%b9%89%e6%a0%b7%e5%bc%8f\/","title":{"rendered":"fastadmin-citypicker \u8bbe\u7f6e\u76d1\u542c\uff0c\u81ea\u5b9a\u4e49\u6837\u5f0f"},"content":{"rendered":"<p>\u67e5\u770b\u4e86\u5b83\u7684\u76d1\u542c\uff0c\u5e76\u4e0d\u662f\u5728\u521d\u59cb\u5316\u7684\u65f6\u5019\u5b9a\u4e49\u53e5\u67c4\u7684<br \/>\n\u53cd\u800c\u662f\u9700\u8981\u7528\u6237\u5728\u5bf9\u8c61\u540e\u9762\u52a0\u4e2aon\u4e8b\u4ef6<\/p>\n<pre><code>\n$(&quot;#city-picker1&quot;).citypicker({\n}).on(&#039;cp:updated&#039;, function () {\nconsole.log(&#039;updated&#039;, $(this).val());\n\n}); <\/code><\/pre>\n<p>citypicker\u91cc\u9762\u7684\u53c2\u6570 \u53ea\u6709\u7701\u5e02\u533a{<br \/>\nprovince: '\u6c5f\u82cf\u7701',<br \/>\ncity: '\u5e38\u5dde\u5e02',<br \/>\ndistrict: '\u6ea7\u9633\u5e02'<br \/>\n}\uff0c\u6ca1\u6709\u522b\u7684\u53c2\u6570\u3002<br \/>\n\u6e90\u7801\u4e86\u8bbe\u7f6e\u4e86\u89e6\u53d1cp:updated\u4e8b\u4ef6\uff0c\u6240\u4ee5\u5c31\u5728\u540e\u9762\u76d1\u542c\u597d\u4e86\u3002<\/p>\n<p>\u5207\u6362\u7701\u4efd\u4e4b\u540e\u56de\u8c03\u7684\u503c\u4e5f\u662f\u5728html\u91cc\u901a\u8fc7data-render\u5b9a\u4e49\u7684\uff0c\u5f88\u5947\u602a\u7684\u8bbe\u5b9a\u3002<\/p>\n<pre><code>&lt;span style=&quot;position: relative;display: inline-block;width: 160px;&quot;&gt;\n            &lt;input readonly id=&quot;city-picker1&quot; type=&quot;text&quot; style=&quot;padding-left: 10px;&quot; data-render=&quot;code&quot; data-spancss=&#039;{&quot;height&quot;: &quot;33px&quot;,&quot;line-height&quot;: &quot;30px&quot;,&quot;border-radius&quot;:&quot;4px&quot;}&#039; data-toggle=&quot;city-picker&quot;  placeholder=&quot;\u67e5\u627e\u7701\u4efd\u5bfa\u5e99&quot; data-level=&quot;province&quot;&gt;\n        &lt;\/span&gt;<\/code><\/pre>\n<p>data-level\u8bbe\u7f6e\u7684\u662f\u652f\u6301\u51e0\u4e2a\u5c42\u7ea7 \uff0cprovince\u662f\u53ea\u663e\u793a\u7701\u4efd\uff0ccity\uff0cdistrict<br \/>\n\u56e0\u4e3aspan\u7684\u6837\u5f0f\u548cplaceholder\u4e0d\u5bf9\u9f50\uff0c\u6240\u4ee5\u6211\u52a0\u4e86\u4e2a\u81ea\u5b9a\u4e49\u7684spancss<br \/>\n\u6e90\u7801\u91cc\u52a0\u4e2a\u8bbe\u7f6e\u5373\u53ef\uff1a<br \/>\npublic\/assets\/libs\/fastadmin-citypicker\/dist\/js\/city-picker.js<br \/>\n95\u884c<br \/>\nvar $select = this.$dropdown.find('.city-select');<br \/>\n\u4e0b\u9762\u52a0<br \/>\nvar spanCss = this.$element.data('spancss') || '';<br \/>\nif(spanCss) {<br \/>\nthis.$textspan.css(spanCss);<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b\u4e86\u5b83\u7684\u76d1\u542c\uff0c\u5e76\u4e0d\u662f\u5728\u521d\u59cb\u5316\u7684\u65f6\u5019\u5b9a\u4e49\u53e5\u67c4\u7684 \u53cd\u800c\u662f\u9700\u8981\u7528\u6237\u5728\u5bf9\u8c61\u540e\u9762\u52a0\u4e2aon &hellip; <a href=\"https:\/\/a.li6.cc\/index.php\/2024\/06\/25\/fastadmin-citypicker-%e8%ae%be%e7%bd%ae%e7%9b%91%e5%90%ac%ef%bc%8c%e8%87%aa%e5%ae%9a%e4%b9%89%e6%a0%b7%e5%bc%8f\/\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[],"_links":{"self":[{"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/posts\/42"}],"collection":[{"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":1,"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":43,"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions\/43"}],"wp:attachment":[{"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/a.li6.cc\/index.php\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}