提交 a2c413a8 作者: vben

fix: the useMessage icon style problem

上级 8f5016e3
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
- 修复热更新时多次注册组件警告问题 - 修复热更新时多次注册组件警告问题
- 修复登录后出现登录标签页 - 修复登录后出现登录标签页
- 修复路由切换参数消失问题 - 修复路由切换参数消失问题
- 修复 useMessage 图标样式问题
## 2.0.0-rc.5 (2020-10-26) ## 2.0.0-rc.5 (2020-10-26)
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
color: @error-color !important; color: @error-color !important;
} }
.modal-icon-info {
color: @primary-color !important;
}
.ant-modal-mask { .ant-modal-mask {
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.2);
} }
......
...@@ -87,6 +87,6 @@ export interface MessageOptions { ...@@ -87,6 +87,6 @@ export interface MessageOptions {
offset?: number; offset?: number;
} }
export interface ModalOptionsEx extends Omit<ModalOptions, 'iconType'> { export interface ModalOptionsEx extends Omit<ModalOptions, 'iconType'> {
iconType: 'warning' | 'success' | 'error'; iconType: 'warning' | 'success' | 'error' | 'info';
} }
export type ModalOptionsPartial = Partial<ModalOptionsEx> & Pick<ModalOptionsEx, 'content'>; export type ModalOptionsPartial = Partial<ModalOptionsEx> & Pick<ModalOptionsEx, 'content'>;
...@@ -13,6 +13,8 @@ function getIcon(iconType: string) { ...@@ -13,6 +13,8 @@ function getIcon(iconType: string) {
return <InfoCircleFilled class="modal-icon-warning" />; return <InfoCircleFilled class="modal-icon-warning" />;
} else if (iconType === 'success') { } else if (iconType === 'success') {
return <CheckCircleFilled class="modal-icon-success" />; return <CheckCircleFilled class="modal-icon-success" />;
} else if (iconType === 'info') {
return <InfoCircleFilled class="modal-icon-info" />;
} else { } else {
return <CloseCircleFilled class="modal-icon-error" />; return <CloseCircleFilled class="modal-icon-error" />;
} }
...@@ -49,7 +51,7 @@ function createModalOptions(options: ModalOptionsPartial, icon: string): ModalOp ...@@ -49,7 +51,7 @@ function createModalOptions(options: ModalOptionsPartial, icon: string): ModalOp
}; };
} }
function createSuccessModal(options: ModalOptionsPartial) { function createSuccessModal(options: ModalOptionsPartial) {
return Modal.success(createModalOptions(options, 'check')); return Modal.success(createModalOptions(options, 'success'));
} }
function createErrorModal(options: ModalOptionsPartial) { function createErrorModal(options: ModalOptionsPartial) {
return Modal.error(createModalOptions(options, 'close')); return Modal.error(createModalOptions(options, 'close'));
...@@ -58,7 +60,7 @@ function createInfoModal(options: ModalOptionsPartial) { ...@@ -58,7 +60,7 @@ function createInfoModal(options: ModalOptionsPartial) {
return Modal.info(createModalOptions(options, 'info')); return Modal.info(createModalOptions(options, 'info'));
} }
function createWarningModal(options: ModalOptionsPartial) { function createWarningModal(options: ModalOptionsPartial) {
return Modal.warning(createModalOptions(options, 'info')); return Modal.warning(createModalOptions(options, 'warning'));
} }
notification.config({ notification.config({
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
</CollapseContainer> </CollapseContainer>
<CollapseContainer class="px-20 bg-white w-full h-32 rounded-md mt-5" title="Comfirm"> <CollapseContainer class="px-20 bg-white w-full h-32 rounded-md mt-5" title="Comfirm">
<a-button @click="handleConfirm('info')" class="mr-2">Info</a-button>
<a-button @click="handleConfirm('warning')" color="warning" class="mr-2">Warning</a-button> <a-button @click="handleConfirm('warning')" color="warning" class="mr-2">Warning</a-button>
<a-button @click="handleConfirm('success')" color="success" class="mr-2">Success</a-button> <a-button @click="handleConfirm('success')" color="success" class="mr-2">Success</a-button>
<a-button @click="handleConfirm('error')" color="error" class="mr-2">Error</a-button> <a-button @click="handleConfirm('error')" color="error" class="mr-2">Error</a-button>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论