1、第一步写前端展示的状态按钮
slot-scope="scope" v-model="scope.row.status" @change="disable(scope.row)" active-color="#13ce66" inactive-color="#ff4949" active-value="1" inactive-value="0">
2、掉按钮绑定的方法
disable(row) {
const { status, phone } = row
if(status=='1'){
}
let params = {
phone: phone,
status: status==1 ? '1' : '0'
};
console.log(params);
//掉后端接口
axios.put('http://localhost:8080/updateAccount',params).then((response) => {
console.log(response)
//this.query();
}).catch((erro) =>{
console.log(erro)
})
},
3.效果
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)