On the problem of elementUI switch

The

list uses the switch component in elementUI

clipboard.png

status is a field returned by the background, which is fine.

the on state is 1 and the off state is 0, but the switch does not correspond here and cannot be displayed here.

the code is as follows:

<el-table-column prop="status" label="status"></el-table-column> //
<el-table-column label="STATUS"> //
    <template slot-scope="scope">
        <el-switch 
            v-model="scope.row.status"
            active-value=1
            inactive-value=0
            @change=change_switch(scope.row.id,scope.row.status)>
        </el-switch>
    </template>
</el-table-column>     

callback is as follows:

change_switch:function(id,status){  
    console.log(status); 
    axios.get("/advertiser/updateStatus",{
        headers: {
            Authorization : getCookie("token"),
        },
        params:{
            id:id,
            status:status
        }
    })
    .then(res=>{
        console.log(res)
    })
},


the on state is 1, and the off state is 0, but the switch does not correspond here and cannot be displayed here.
active-value=0
inactive-value=1

are you sure. Write it backwards.

Menu