<el-switch v-model="item.recommend" //绑定的值
active-value="1"
inactive-value="0"
@change=chang($event,item.id)>
</el-switch>
methods: {
chang(data,b){
$.ajax({
url: "{:U(update_recommend)}",
type: 'POST',
data: {
id: b,
recommend: data,
},
success: function (res) {
layer.msg(res.msg, {time: 2000}, function () {
})
}
});
}
}