Skip to content

Commit

Permalink
refactor(toggle): rename selectedValue and unselectedValue to onValue…
Browse files Browse the repository at this point in the history
… and offValue
  • Loading branch information
Hossein Mirazimi committed Jan 2, 2024
1 parent 97276ac commit 7859111
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/runtime/components/forms/Toggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ export default defineComponent({
type: AnyType,
default: false
},
selectedValue: {
onValue: {
type: AnyType,
default: true
},
unselectedValue: {
offValue: {
type: AnyType,
default: false
},
Expand Down Expand Up @@ -107,13 +107,13 @@ export default defineComponent({
const active = computed({
get () {
if (typeof props?.selectedValue === 'object') {
return isEqual((props.modelValue as Record<string, unknown> | unknown[]), (props.selectedValue as Record<string, unknown> | unknown[]))
if (typeof props?.onValue === 'object') {
return isEqual((props.modelValue as Record<string, unknown> | unknown[]), (props.onValue as Record<string, unknown> | unknown[]))
}
return props.modelValue === props.selectedValue
return props.modelValue === props.onValue
},
set (value) {
emit('update:modelValue', !value ? props.unselectedValue : props.selectedValue)
emit('update:modelValue', !value ? props.offValue : props.onValue)
emitFormChange()
}
})
Expand Down

0 comments on commit 7859111

Please sign in to comment.