EASYAIuniappNewUI/node_modules/@tuniao/tnui-vue3-uniapp/hooks/use-component-size/index.ts
2025-02-08 18:50:38 +08:00

18 lines
542 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { computed } from 'vue'
import { componentSizes } from '../../constants'
export const componentSizeTypes = ['none', 'inner', 'custom'] as const
export type ComponentSizeType = (typeof componentSizeTypes)[number]
export const useComponentSize = (size?: string | number) => {
// size类型内置size类型还是设置的自定义size大小
const sizeType = computed<ComponentSizeType>(() => {
if (!size) return 'none'
return componentSizes.includes(size as any) ? 'inner' : 'custom'
})
return {
sizeType,
}
}