layuiAdmin中的select两级联动问题

提问 未结 5 213
飞鱼653
悬赏:50飞吻
版本:layuiAdmin 浏览器:
<script type="text/html" lay-url="http:" template >
<div class="layui-form-item">
<label class="layui-form-label"><span class="layui-word-red">*</span>选择客户经理:</label>
<div class="layui-input-inline" style="width:200px">
<select name="city" lay-filter="org" id="a">
{{# layui.each(d.data.organization, function(index, item){ }}
<option value="{{item.id}}">{{item.name}}</option>
{{# }); }}
</select>
</div>
<div class="layui-input-inline" style="width:200px" >
<select name="city" id='per'>
<option value=""></option>
</select>
</div>
</div>
</script>
 form.on('select(org)', function(data){
var val = data.value
admin.req({
url:'http://',
success:res=>{
let predata = res.data.org_members[val]
console.log(predata)
$('#per option').hide();
var preHtml = '';
for(let i in predata){
preHtml += `
<option value="${predata[i].id}">${predata[i].name}</option>
`
}
$('#pre').html(preHtml);
form.render(null);
}
})
})
但是页面 $('#pre').html(preHtml); 添加的就是显示不出来
回帖