首先是要做一個這樣的效果,需要用到開關,但是加上開關效果,不生效,沒法做到點一次,換一次。
因為要做到每一行單獨控制。所以這個值是到時候每個數據體里面去拿的,所以要借助scope.row去獲得。
解決方法:在el-switch外用template包住,加上slot-scope,
要想在表格中每個switch都單獨的控制,寫法v-mode=“scope.row.自己定義。
<template slot-scope="scope">
<el-switch
v-model="scope.row.p9"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="N"
inactive-value="Y"
>
</el-switch>
</template>