el-switch 初始值(默認值)不能正確顯示狀態問題


<el-table-column align="center" label="狀態">
      <template slot-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-column align="center" label="狀態">
      <template slot-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>
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM