说明:layui中用jquery 中的选择器例如$('#id').change(function(){})发现不起作用layui操作:lay-felter标识操作哪个selecthtml部分:<select name="shop_id" lay-verify="required" lay-search="" lay-filter="select_shop"><option value="0">请选择门店</option><option value="1">门店1</option><option value="1">门店2</option> </select>script部分: layui.use(['form','layer','table','jquery'],function(){ var form = layui.form; form.on('select(select_shop)', function(data){$scope.select_shop = data.value;var html = '<option value="0">请选择摄影师</option>';$.post("{:url('/json/getShopCameraman')}", {shop_id: $scope.select_shop}, function(data) {$(data.data).each(function(index, item) {html += '<option value="' + item.id + '">' + item.name + '</option>';});$("#select_cameraman").html(html);form.render('select'); //这个很重要,没有这个新的option不会显示}, 'json'); }); })
参考:https://www.cnblogs.com/luqiangblogs/p/12503400.html