feat: add button

This commit is contained in:
2023-03-27 07:51:19 +08:00
parent 2b2ef3a3fb
commit 3ba0d997d5
8 changed files with 265 additions and 22 deletions

View File

@ -0,0 +1,8 @@
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>
}

View File

@ -0,0 +1,9 @@
import type { ComputedRef } from 'vue'
import { computed } from 'vue'
import type { SizeType } from '../../config-provider/context'
import { useProviderConfigState } from '../../config-provider/context'
export const useSize = (props: Record<string, any>) => {
const { componentSize } = useProviderConfigState()
return computed(() => props.size || componentSize.value) as ComputedRef<SizeType>
}

View File

@ -0,0 +1,21 @@
import { warning as rcWarning, resetWarned } from '@v-c/utils'
export { resetWarned }
export function noop() {}
type Warning = (valid: boolean, component: string, message?: string) => void
// eslint-disable-next-line import/no-mutable-exports
let warning: Warning = noop
if (process.env.NODE_ENV !== 'production') {
warning = (valid, component, message) => {
rcWarning(valid, `[antd: ${component}] ${message}`)
// StrictMode will inject console which will not throw warning in React 17.
if (process.env.NODE_ENV === 'test') {
resetWarned()
}
}
}
export default warning