/** picker底部滑动选择数据(一列,两列) * arr: 数据 * nameEl: 点击对象 * valEl: 保存所选值 * oper: 区分 value 和 innerHTMl * title: 顶部标题 */function pickerShow(arr, nameEl, valEl, oper, title) { var picker = new Picker({ data: arr, selectedIndex: [0, 1], title: title }); picker.on('picker.select', function(selectedVal, selectedIndex) { valEl.innerHTML = ''; for(var i = 0; i < arr.length; i++) { if(oper === 0) { valEl.value += arr[i][selectedIndex[i]].text; } else { valEl.innerHTML += arr[i][selectedIndex[i]].text; } } }); nameEl.addEventListener('click', function() { picker.show(); console.log('ok'); });}