文档例子:http://www.jq22.com/yanshi14757
引入:
<script src="<?php echo $this->SURL('/js/citydata.min.js') ?>"></script>
<script src="<?php echo $this->SURL('/js/cityPicker-2.0.3.js') ?>"></script>
<script src="<?php echo $this->SURL('/js/jquery.min.js') ?>"></script>
html:
<div class="cityCon"></div>
js:
selectCity = $('.cityCon').cityPicker({
dataJson: cityData,
renderMode: false,
autoSelected: false,
level: 2,//二级,3:三级
});
$('.cityCon').on('choose-province.citypicker', function (event, tagert, storage) {
app.userInfo.province = storage.name;
});
$('.cityCon').on('choose-city.citypicker', function (event, tagert, storage) {
if (storage.id == "0") {
return;
}
app.userInfo.city = storage.name;
});