Skip to content

Commit

Permalink
refactor(components): [switch] switch to script-setup syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxch committed May 31, 2022
1 parent 05ad5ab commit 21eead6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/components/switch/src/switch.vue
Expand Up @@ -120,7 +120,7 @@ const { inputId } = useFormItemInputId(props, {
const switchSize = useSize()
const switchDisabled = useDisabled(computed(() => props.loading))
const isControlled = ref(props.value === false)
const isControlled = ref(props.modelValue !== false)
const input = ref<HTMLInputElement>()
const core = ref<HTMLSpanElement>()
Expand Down Expand Up @@ -194,7 +194,10 @@ const switchValue = () => {
const shouldChange = beforeChange()
const isPromiseOrBool = isPromise(shouldChange) || isBoolean(shouldChange)
const isPromiseOrBool = [
isPromise(shouldChange),
isBoolean(shouldChange),
].includes(true)
if (!isPromiseOrBool) {
throwError(
COMPONENT_NAME,
Expand Down

0 comments on commit 21eead6

Please sign in to comment.