公司项目早期版本使用了JqueryWeui,不是weui.io那个。
1、Picker要将input改为div
<input class="weui_input" id="drpPerson" type="text" value="" placeholder="请选择" readonly="" data-values="">
改为
<div class="weui_input" id="drpPerson" >
不然无法自动替换
2、$("#drpPerson").picker({下增加
onOpen: function (p, v, d) { setTimeout(function () { $("#drpPerson").html(p.displayValue[0]); $("#drpPerson").show(); renderTxlBind(); },100); },
虽然官方文档没有onOpen,但是测试是可以这样写的
3、同上,替换onChange,onClose下增加
renderTxlBind
4、rederTxlBind是封装的一个函数
function renderTxlBind() { if (document.querySelectorAll('ww-open-data').length > 0) { if (window.WWOpenData != undefined) { WWOpenData.bindAll(document.querySelectorAll('ww-open-data')); } } }