Skip to content

Commit

Permalink
fix(Modal): update 方法逻辑修正,内容为空就不做处理 (#782)
Browse files Browse the repository at this point in the history
* fix: update 方法逻辑修正,内容为空就不做处理

* fix: 更改更新逻辑中关于内容的判断

---------

Co-authored-by: blankzhang <blankzhang@blankzhangdeMac-mini.local>
  • Loading branch information
zym19960704 and blankzhang committed Apr 29, 2024
1 parent 354e83b commit a620cf8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/modal/modalApi.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type VNode, type VNodeChild, render } from 'vue';
import { isFunction, isUndefined } from 'lodash-es';
import { isFunction, isNil, isUndefined } from 'lodash-es';
import Modal from './modal';
import type { ModalType } from './props';

Expand Down Expand Up @@ -105,10 +105,12 @@ function create(type: ModalType, config: ModalConfig) {
// 更新 slots
['title', 'content', 'footer'].forEach((key) => {
const slot = options[key as VNodeProperty];
// 如果有slot,则更新
if (slot) {
slots[key] = isFunction(slot) ? slot : () => slot;
}
if (key === 'content') {
// 如果不为空再更新
if (key === 'content' && !isNil(slots.content)) {
slots.default = slots.content;
delete slots.content;
}
Expand Down

0 comments on commit a620cf8

Please sign in to comment.