VUE Element ui el-switch文字在开关里面显示
UE Element ui el-switch文字在开关里面显示
·
<el-switch
:value="true"
active-color="#2b73bb"
inactive-color="#DCDFE6"
class="switchStyle"
:active-value="true"
:inactive-value="false"
active-text="开"
inactive-text="关">
</el-switch>
样式:
<style lang="scss" scoped>
::v-deep .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
/*打开时文字位置设置*/
::v-deep .el-switch__label--right {
z-index: 1;
right: 20px;
}
/*关闭时文字位置设置*/
::v-deep .el-switch__label--left {
z-index: 1;
left: 20px;
}
/*显示文字*/
::v-deep .el-switch__label.is-active {
display: block;
}
::v-deep .el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 55px;
}
</style>
更多推荐
已为社区贡献2条内容
所有评论(0)