第一种:是字符串enable为开启状态,disable为关闭状态
<el-form-item label="状态" :label-width="formLabelWidth1">
<el-switch v-model="form.state" active-text="开启" active-value="enable" inactive-value="disable" active-color="#13ce66">
</el-switch>
</el-form-item>
第二种:是可显示开启关闭描述文字
<el-table-column label="操作" align="center" width="">
<template slot-scope="scope">
<el-switch
v-model="scope.row.on"
on-color="#00A854"
on-text="启动"
on-value="1"
off-color="#F04134"
off-text="禁止"
off-value="0"
@change="changeSwitch(scope.row)">
</el-switch>
</template>
</el-table-column>
效果如下: