数据动态加载后,在浏览器中运行是正常的
,在hbuilder基本运行时不正常,
,而且手机上运行时,需要点击两次才可以选择。
页面代码如下:
<div class="mui-content">
<div class="mui-content-padded">
<button id='showCityPicker3' class="mui-btn mui-btn-block" type='button'>三级联动示例 ...</button>
<div id='cityResult3' class="ui-alert"></div>
</div>
</div>
var showCityPickerButton = document.getElementById('showCityPicker3');
var cityResult3 = document.getElementById('cityResult3');
showCityPickerButton.addEventListener('tap', function(event) {
var cityPicker3 = new $.PopPicker({
layer: 3
});
cityPicker3.setData(cityData);
cityPicker3.show(function(items) {
cityResult3.innerText = "你选择的城市是:" + (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
//返回 false 可以阻止选择框的关闭
//return false;
cityPicker3.dispose();
});
}, false);