mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-03 12:37:42 +08:00
36 lines
1016 B
Vue
36 lines
1016 B
Vue
import Empty from '../empty';
|
|
import type { VueNode } from '../_util/type';
|
|
import useConfigInject from './hooks/useConfigInject';
|
|
|
|
export interface RenderEmptyProps {
|
|
componentName?: string;
|
|
}
|
|
|
|
export const DefaultRenderEmpty = (props: RenderEmptyProps) => {
|
|
const { prefixCls } = useConfigInject('empty', props);
|
|
const renderHtml = (componentName?: string) => {
|
|
switch (componentName) {
|
|
case 'Table':
|
|
case 'List':
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
case 'Select':
|
|
case 'TreeSelect':
|
|
case 'Cascader':
|
|
case 'Transfer':
|
|
case 'Mentions':
|
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} class={`${prefixCls.value}-small`} />;
|
|
default:
|
|
return <Empty />;
|
|
}
|
|
};
|
|
return renderHtml(props.componentName);
|
|
};
|
|
|
|
function renderEmpty(componentName?: string): VueNode {
|
|
return <DefaultRenderEmpty componentName={componentName} />;
|
|
}
|
|
|
|
export type RenderEmptyHandler = typeof renderEmpty;
|
|
|
|
export default renderEmpty;
|