美文网首页
vue element-ui列表中el-switch 开关,使用

vue element-ui列表中el-switch 开关,使用

作者: wodeph | 来源:发表于2021-11-25 18:27 被阅读0次

需求说明

1、根据后台传值动态显示开关(0为关,1为开)

在 :active-value="1" :inactive-value="0"  这样写才解决显示问题  如果还要提交服务器的时候需注意要根据你设置的value值,变换一下传数值上去

参数传递(参数包括:当前的状态 $event、当前数据的值对象scope.row、当前的序号scope.$index)

<template slot-scope="scope">

       <el-switch v-model="scope.row.isWakeup"

                                :active-value="1"

                                :inactive-value="0"

                    @change="changSwitchState($event,scope.row,scope.$index)">

        </el-switch>

</template>

相关文章

网友评论

      本文标题:vue element-ui列表中el-switch 开关,使用

      本文链接:https://www.haomeiwen.com/subject/mbkztrtx.html