关于javascript:elementUI-switch组件单机方法及disabled样式问题

elementUI switch组件

  • 无click事件,想要二次确认后再进行状态更改
  • 应用change事件不好用会先更新状态,不好用

    解决

<el-switch
@click.native.prevent="updataStatus(xxx,xxx,xxx)",
disabled
>
</el-switch>
  • 增加@click.native.prevent办法达到目标,
  • 与此同时须要关上disabled属性

    • 是因为不加disabled会呈现调用两次的非现实状态

disabled款式问题

  • 保障批改完后同失常无异

不倡议在这里批改,我没改进去。目前办法是去掉scoped,你改的代码间接失效

<style lang="less" scoped>
</style>

应用深度选择器>>>进行批改

<style>
</style>

在原有style标签外再加一个style标签写在新加的标签里

<style>
/* 批改elementUI-switch组件 disabled款式 */
.el-switch.is-disabled {
 opacity: 1;
}
.el-switch.is-disabled .el-switch__core, .el-switch.is-disabled .el-switch__label {
  cursor: pointer !important;
}
</style>

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理