mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-02-03 10:28:41 +08:00
fix(use-message): content
not support vNode
修复封装的`useMessage`部分函数中`content`不支持vNode类型以及`createConfirm`不支持html的问题
This commit is contained in:
parent
0acc4ab2dd
commit
154ebc3d96
@ -5,6 +5,7 @@ import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-des
|
|||||||
|
|
||||||
import { ArgsProps, ConfigProps } from 'ant-design-vue/lib/notification';
|
import { ArgsProps, ConfigProps } from 'ant-design-vue/lib/notification';
|
||||||
import { useI18n } from './useI18n';
|
import { useI18n } from './useI18n';
|
||||||
|
import { isString } from '/@/utils/is';
|
||||||
|
|
||||||
export interface NotifyApi {
|
export interface NotifyApi {
|
||||||
info(config: ArgsProps): void;
|
info(config: ArgsProps): void;
|
||||||
@ -46,7 +47,11 @@ function getIcon(iconType: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderContent({ content }: Pick<ModalOptionsEx, 'content'>) {
|
function renderContent({ content }: Pick<ModalOptionsEx, 'content'>) {
|
||||||
return <div innerHTML={`<div>${content as string}</div>`}></div>;
|
if (isString(content)) {
|
||||||
|
return <div innerHTML={`<div>${content as string}</div>`}></div>;
|
||||||
|
} else {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,6 +64,7 @@ function createConfirm(options: ModalOptionsEx): ConfirmOptions {
|
|||||||
centered: true,
|
centered: true,
|
||||||
icon: getIcon(iconType),
|
icon: getIcon(iconType),
|
||||||
...options,
|
...options,
|
||||||
|
content: renderContent(options),
|
||||||
};
|
};
|
||||||
return Modal.confirm(opt) as unknown as ConfirmOptions;
|
return Modal.confirm(opt) as unknown as ConfirmOptions;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user