我用的element UI 组件库,
active-value,inactive-value:自定义打开与关闭的状态值,
active-color,inactive-color:自定义打开与关闭的颜色
1 <el-table-column prop="accountStatus" label="账号状态" align="center"> 2 <template slot-scope="scope"> 3 <el-switch 4 v-model="scope.row.accountStatus" 5 @change="changeSwitch(scope.row)" 6 active-color="#FFBB10" 7 inactive-color="#E8E8E8" 8 :active-value="1" 9 :inactive-value="0" 10 > 11 </el-switch> 12 </template> 13 </el-table-column>
changeSwitch(val){},带过来对应数据,再进行操作就可以了