html
<div class="form-picker-container"
id="a"
data-layer="1"
data-setData='[{"value":"加重","text":"加重"},{"value":"减轻","text":"减轻"},{"value":"无变化","text":"无变化"}]'>
<span>请选择</span>
</div>
js
$(".form-picker-container").each(function(){
var that = $(this);
var id = that.attr('id');
var setData = that.attr('data-setData');
setData = JSON.parse(setData);
var arr = [];
for(var i=0;i<setData.length;i++){
var brr = setData[i];
var value = brr.value;
var text = brr.text;
arr.push({value:value, text:text});
}
that.on('tap', function() {
var picker = new mui.PopPicker();
picker.setData(arr);
picker.show(function(items) {
//that.val(items[0].value);
$('#' + id).html(items[0].text);
picker.dispose();
});
});
});