字体变色
温度表中 温度超过37.3度学生的姓名变红
,{field: 'wd', title: '温度', width:180}
,{field: 'student', title: '姓名', width:180, templet: function(d){
// return d.student.stuname;
var span="";
if (d.wd>=37.3){
return span += '<span style="color: red">'+d.student.stuname+'</span>';
}
return d.student.stuname;
}}
下拉框(固定值)
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-inline">
<select name="status">
<option value="0" id="off">已启用</option>
<option value="1" id="in">已停用</option>
</select>
</div>
</div>
</div>
下拉框(不固定值)
js
function showDept(qwe) {
$.ajax({
type:"post",
url:"doc/allDoc",
dataType:"json",
success:function(msg){
$("#selectID option").remove()
var option="<option id=‘option'>请选择</option>";
let list=msg.data;
for (let i=0;i<list.length;i++){
let sdsd=qwe==null?"":list[i].did == qwe.doctor.did?'selected="selected"':'';
option+="<option value='"+list[i].did+"' "+sdsd+" >"+list[i].dname+"</option>"
}
$("#selectID").append(option);
form.render();
}
});
}
html
<div class="layui-form-item">
<label class="layui-form-label">学生:</label>
<div class="layui-input-inline">
<select id="selectID" name="stuid">
</select>
</div>
</div>