antd-tiny-vue/components/_util/hooks/disabled.ts

9 lines
353 B
TypeScript
Raw Normal View History

2023-03-27 07:51:19 +08:00
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>
}