Skip to content

Commit bc7a9df

Browse files
committed
changed buttonBackground to switchColor
1 parent 23b14f0 commit bc7a9df

File tree

3 files changed

+47
-47
lines changed

3 files changed

+47
-47
lines changed

dist/index.js

Lines changed: 14 additions & 14 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: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Button.vue

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const constants = {
3333
width: 50,
3434
height: 22,
3535
margin: 3,
36-
buttonBackground: '#fff'
36+
switchColor: '#fff'
3737
}
3838
3939
const contains = (object, title) => {
@@ -69,7 +69,7 @@ export default {
6969
: typeof value === 'string'
7070
}
7171
},
72-
buttonBackground: {
72+
switchColor: {
7373
type: [String, Object],
7474
validator (value) {
7575
return typeof value === 'object'
@@ -135,7 +135,7 @@ export default {
135135
transform: this.toggled
136136
? `translate3d(${this.distance}, 3px, 0px)`
137137
: null,
138-
background: this.buttonBackground ? this.buttonBackgroundCurrent : undefined
138+
background: this.switchColor ? this.switchColorCurrent : undefined
139139
}
140140
},
141141
@@ -183,32 +183,32 @@ export default {
183183
: constants.labelUnchecked
184184
},
185185
186-
buttonBackgroundChecked () {
187-
let { buttonBackground } = this
186+
switchColorChecked () {
187+
let { switchColor } = this
188188
189-
return contains(buttonBackground, 'checked')
190-
? buttonBackground.checked
191-
: constants.buttonBackground
189+
return contains(switchColor, 'checked')
190+
? switchColor.checked
191+
: constants.switchColor
192192
},
193193
194-
buttonBackgroundUnchecked () {
195-
let { buttonBackground } = this
194+
switchColorUnchecked () {
195+
let { switchColor } = this
196196
197-
return contains(buttonBackground, 'unchecked')
198-
? buttonBackground.unchecked
199-
: constants.buttonBackground
197+
return contains(switchColor, 'unchecked')
198+
? switchColor.unchecked
199+
: constants.switchColor
200200
},
201201
202-
buttonBackgroundCurrent () {
203-
let { buttonBackground } = this
202+
switchColorCurrent () {
203+
let { switchColor } = this
204204
205-
if (typeof buttonBackground !== 'object') {
206-
return buttonBackground || constants.buttonBackground
205+
if (typeof switchColor !== 'object') {
206+
return switchColor || constants.switchColor
207207
}
208208
209209
return this.toggled
210-
? this.buttonBackgroundChecked
211-
: this.buttonBackgroundUnchecked
210+
? this.switchColorChecked
211+
: this.switchColorUnchecked
212212
}
213213
214214
},

0 commit comments

Comments
 (0)