Skip to content

Commit 0805410

Browse files
committed
fix: patchOptions fix
1 parent d612ad9 commit 0805410

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/vue-final-modal/src/useApi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ export const useModal: IOverloadedUseModalFn = function (_options: UseModalOptio
9494
if (slots) {
9595
Object.entries(slots).forEach(([name, slot]) => {
9696
const originSlot = options.slots![name]
97-
if (isModalSlotOptions(originSlot) && isModalSlotOptions(slot))
97+
if (isString(originSlot))
98+
options.slots![name] = slot
99+
else if (isModalSlotOptions(originSlot) && isModalSlotOptions(slot))
98100
patchComponentOptions(originSlot, slot)
99101
else
100102
options.slots![name] = slot
@@ -138,7 +140,7 @@ type ComponentOptions = {
138140
attrs?: Record<string, any>
139141
}
140142

141-
function patchComponentOptions(options: ComponentOptions, newOptions: ComponentOptions) {
143+
function patchComponentOptions(options: ComponentOptions | ModalSlotOptions, newOptions: ComponentOptions | ModalSlotOptions) {
142144
if (newOptions.component)
143145
options.component = newOptions.component
144146

0 commit comments

Comments
 (0)