Skip to content

Commit

Permalink
Fixed switch custom color with disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
gogu authored and Leopoldthecoder committed Dec 8, 2016
1 parent ec3bb5d commit 88a5772
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/docs/en-US/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## Switch

Switch is used for switching between two opposing states.
Switch is used for switching between two opposing states.

### Basic usage

Expand Down Expand Up @@ -45,7 +45,7 @@ Switch is used for switching between two opposing states.

### Disabled

:::demo Adding the `disabled` attribute disables Switch.
:::demo Adding the `disabled` attribute disables Switch.

```html
<el-switch
Expand Down
2 changes: 1 addition & 1 deletion packages/switch/src/component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
this.coreWidth = this.hasText ? 58 : 46;
}
this.handleButtonTransform();
if ((this.onColor || this.offColor) && !this.disabled) {
if (this.onColor || this.offColor) {
this.setBackgroundColor();
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/theme-default/src/switch.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@

@when disabled {
.el-switch__core {
border-color: var(--switch-disabled-color);
background: var(--switch-disabled-color);
border-color: var(--switch-disabled-color) !important;
background: var(--switch-disabled-color) !important;

& span {
background-color: var(--switch-disabled-text-color);
background-color: var(--switch-disabled-text-color) !important;
}

& ~ .el-switch__label * {
color: var(--switch-disabled-text-color);
color: var(--switch-disabled-text-color) !important;
}
}

Expand Down

0 comments on commit 88a5772

Please sign in to comment.