Skip to content

Commit e18a628

Browse files
committed
Allow deactivation of automatic color styling
Closes #36
1 parent aee66e0 commit e18a628

File tree

4 files changed

+23
-35
lines changed

4 files changed

+23
-35
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ Use:
3535

3636
### Properties
3737

38-
| Name | Type | Default | Description |
39-
| --- | --- | --- | --- |
40-
| value | Boolean | false | Initial state of the toggle button |
41-
| sync | Boolean | false | If set to `true`, will be watching changes in `value` property and overwrite the current state of the button whenever `value` prop. changes |
42-
| speed | Number | 300 | Transition time for the animation |
43-
| disabled | Boolean | false | Button does not react on mouse events |
44-
| color | [String, Object] | `#75C791` | if `String` - color of the button when checked <br>If `Object` - colors for the button when checked/uncheked <br>Example: `{checked: '#00FF00', unchecked: '#FF0000'}` |
38+
| Name | Type | Default | Description |
39+
| --- | --- | --- | --- |
40+
| value | Boolean | false | Initial state of the toggle button |
41+
| sync | Boolean | false | If set to `true`, will be watching changes in `value` property and overwrite the current state of the button whenever `value` prop. changes |
42+
| speed | Number | 300 | Transition time for the animation |
43+
| disabled | Boolean | false | Button does not react on mouse events |
44+
| color | [String, Object, null] | `#75C791` | If `String` - color of the button when checked <br>If `Object` - colors for the button when checked/uncheked <br>If `null` - Deactivate colors in favor of CSS styling <br>Example: `{checked: '#00FF00', unchecked: '#FF0000'}` |
4545
| labels | [Boolean, Object] | false | If `Boolean` - shows/hides default labels ("on" and "off") <br>If `Object` - sets custom labels for both states. <br>Example: `{checked: 'Foo', unchecked: 'Bar'}` |
4646
| width | Number | 50 | Width of the button, default is 50 |
4747
| height | Number | 22 | Height of the button, default is 22 |

dist/index.js

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ssr.index.js

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Button.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,22 @@ export default {
132132
133133
colorChecked () {
134134
let { color } = this
135-
136-
if (typeof color !== 'object') {
137-
return color || constants.colorChecked
138-
}
139-
140-
return contains(color, 'checked')
141-
? color.checked
142-
: constants.colorChecked
135+
return color === null
136+
? undefined
137+
: typeof color !== 'object'
138+
? color || constants.colorChecked
139+
: contains(color, 'checked')
140+
? color.checked
141+
: constants.colorChecked
143142
},
144143
145144
colorUnchecked () {
146145
let { color } = this
147-
148-
return contains(color, 'unchecked')
149-
? color.unchecked
150-
: constants.colorUnchecked
146+
return color === null
147+
? undefined
148+
: contains(color, 'unchecked')
149+
? color.unchecked
150+
: constants.colorUnchecked
151151
},
152152
153153
colorCurrent () {

0 commit comments

Comments
 (0)