一、switch开关修改
layui.use(['admin', 'table', 'view', 'form', 'layer','ourJs'], function () {
var table = layui.table
,admin = layui.admin
,form = layui.form
,layer = layui.layer
,ourJs = layui.ourJs
,view = layui.view;
form.on('switch(checkbox_ishot)', function (e) {
var _this=this,status=e.elem.checked;
admin.req({
url: '你的接口'
,data: {
id: e.value }
,type: 'post'
,success: function (res) {
if (res.code == 1) {
ourJs.status_tong(table,_this,status,'is_hot');
} else {
layer.msg(res.msg, {
icon: 5, anim: 6, shade: 0.5, time: 1000 });
}
}
});
});
}