fix: empty type
parent
8cb7c65684
commit
347f69fa66
|
@ -1,4 +1,4 @@
|
||||||
import { CSSProperties, VNodeTypes, inject, App, SetupContext } from 'vue';
|
import { CSSProperties, VNodeTypes, inject, App, SetupContext, FunctionalComponent } from 'vue';
|
||||||
import classNames from '../_util/classNames';
|
import classNames from '../_util/classNames';
|
||||||
import { defaultConfigProvider, ConfigConsumerProps } from '../config-provider';
|
import { defaultConfigProvider, ConfigConsumerProps } from '../config-provider';
|
||||||
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||||
|
@ -20,10 +20,16 @@ export interface EmptyProps {
|
||||||
imageStyle?: CSSProperties;
|
imageStyle?: CSSProperties;
|
||||||
image?: VNodeTypes | null;
|
image?: VNodeTypes | null;
|
||||||
description?: VNodeTypes;
|
description?: VNodeTypes;
|
||||||
children?: VNodeTypes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Empty = (props: EmptyProps, { slots }: SetupContext) => {
|
interface EmptyType extends FunctionalComponent<EmptyProps> {
|
||||||
|
displayName: string;
|
||||||
|
PRESENTED_IMAGE_DEFAULT: VNodeTypes;
|
||||||
|
PRESENTED_IMAGE_SIMPLE: VNodeTypes;
|
||||||
|
install: (app: App) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Empty: EmptyType = (props: EmptyProps, { slots }: SetupContext) => {
|
||||||
const configProvider = inject<ConfigConsumerProps>('configProvider', defaultConfigProvider);
|
const configProvider = inject<ConfigConsumerProps>('configProvider', defaultConfigProvider);
|
||||||
const { getPrefixCls, direction } = configProvider;
|
const { getPrefixCls, direction } = configProvider;
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -1,7 +1,20 @@
|
||||||
import { defaultTo } from 'lodash-es';
|
|
||||||
import Empty from '../components/empty';
|
import Empty from '../components/empty';
|
||||||
import '../components/empty/style';
|
import '../components/empty/style';
|
||||||
|
|
||||||
|
type TypeName<T> = T extends string
|
||||||
|
? 'string'
|
||||||
|
: T extends number
|
||||||
|
? 'number'
|
||||||
|
: T extends boolean
|
||||||
|
? 'boolean'
|
||||||
|
: T extends undefined
|
||||||
|
? 'undefined'
|
||||||
|
: T extends Function
|
||||||
|
? 'function'
|
||||||
|
: 'object';
|
||||||
|
|
||||||
|
type T10 = TypeName<string | (() => void)>;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
render() {
|
render() {
|
||||||
return <Empty />;
|
return <Empty />;
|
||||||
|
|
Loading…
Reference in New Issue