el-switch 初始值(預設值)不能正確顯示狀態問題
阿新 • • 發佈:2020-06-28
<el-table-columnalign="center"label="狀態"> <templateslot-scope="scope"> <el-switch @change="usertypefun(scope.row.us_id,$event)" v-model="scope.row.us_state" active-color="#13ce66" inactive-color="#ff4949" active-value="1" inactive-value="0"> </el-switch> </template> </el-table-column>
說明:當用如上的【active-value="1" inactive-value="0"】,此時的【active-value】值型別為string,如果要求【active-value】值型別為number時,必須在其前面加上 :
<el-table-columnalign="center"label="狀態"> <templateslot-scope="scope"> <el-switch @change="usertypefun(scope.row.us_id,$event)" v-model="scope.row.us_state" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0"> </el-switch> </template> </el-table-column>