💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# selectCity(选择城市函数封装) 相关代码如下: ``` /** * [selectCity 选择城市函数封装] * @param {[type]} idName [要设置城市信息的表单的id] */ function selectCity(idName) { UIActionSelector = api.require('UIActionSelector'); UIActionSelector.open({ datas: 'widget://res/city.json', //必须包含此json文件 layout: { row: 5, col: 3, height: 30, size: 13, sizeActive: 13, rowSpacing: 5, colSpacing: 10, maskBg: 'rgba(0,0,0,0.2)', bg: '#fff', color: '#888', colorActive: '#f00', colorSelected: '#f00' }, animation: true, cancel: { text: '取消', size: 12, w: 90, h: 35, bg: '#fff', bgActive: '#ccc', color: '#888', colorActive: '#fff' }, ok: { text: '确定', size: 12, w: 90, h: 35, bg: '#fff', bgActive: '#ccc', color: '#888', colorActive: '#fff' }, title: { text: '请选择', size: 12, h: 44, bg: '#eee', color: '#888' }, fixedOn: api.frameName }, function(ret, err) { if (ret) { if (ret.level3 == null) { var region = ret.level1 + ret.level2; $api.val($api.byId(idName), region); } else { var region = ret.level1 + ret.level2 + ret.level3; // alert($api.jsonToStr(ret)); $api.val($api.byId(idName), region); $api.setStorage('pid', ret.selectedInfo[0].province_id); $api.setStorage('cid', ret.selectedInfo[1].city_id); $api.setStorage('did', ret.selectedInfo[2].district_id); } } else { alert(JSON.stringify(err)); } }); } ``` 相关示例: 相关图片: