select 动态赋值 layui重新渲染

select下拉框

   <select id="ZhiWuErJi" class="layui-input " type1="flow_select" isflow="1" required="required" name="ZhiWuErJi">
  </select>

Js

   $(window).load(function () {
         
        var q1 = document.getElementById("ZhiJi");
        console.log(q1.options.length);
        for (var i = 0; i < q1.options.length; i++) {
            if (q1.options[i].value == "@info.ZhiJi") {
                q1.options[i].selected = true;
            }
        }
    //layui重新渲染
      layui.use(form, function(){
           var form = layui.form;//高版本建议把括号去掉,有的低版本,需要加()
           form.render(select);
           //form.render();
       });
}

 

文章来自:https://www.cnblogs.com/youmingkuang/p/12092832.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3