antd-tiny-vue/components/_util/hooks/disabled.ts
2023-03-27 07:51:19 +08:00

9 lines
353 B
TypeScript

import type { ComputedRef } from 'vue'
import { computed } from 'vue'
import { useProviderConfigState } from '../../config-provider/context'
export const useDisabled = (props: Record<string, any>) => {
const { componentDisabled } = useProviderConfigState()
return computed(() => props.disabled || componentDisabled.value) as ComputedRef<boolean>
}