Skip to content

Commit

Permalink
chore: fix recursive createVNode
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterliu1003 committed Jan 29, 2024
1 parent ee11efe commit 449764b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/vue-final-modal/src/useVNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { isString, objectEntries } from './utils'
*/
export function createVNode<T extends Component>(options: CreateVNodeOptions<T>) {
const id = Symbol(__DEV__ ? 'createVNode' : '')
const vNode = _h(options.component, { key: id, ...options.attrs }, options.slots)
const vNode = _h(options.component, { key: id, ...options.attrs }, getSlots(options.slots))
return vNode
}

Expand Down
14 changes: 11 additions & 3 deletions viteplay/src/components/VueFinalModal/Basic.example.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref } from 'vue'
import { ModalsContainer, VueFinalModal, h, useModal, useVNode, useVfm } from 'vue-final-modal'
import { ModalsContainer, VueFinalModal, createVNode, h, useModal, useVNode, useVfm } from 'vue-final-modal'
import DefaultSlot from '../DefaultSlot.vue'
import { modal } from './modalsHelpers'
import TestModal from './TestModal.vue'
Expand Down Expand Up @@ -80,10 +80,18 @@ function clickOutside() {
// show.value = true
// })
const { show: _show } = useVNode(h({
const { show: _show } = useVNode(createVNode({
component: DefaultSlot,
attrs: {
text: 'h',
text: 'createVNode',
},
slots: {
default: h({
component: DefaultSlot,
attrs: {
text: '123456',
},
}),
},
// slots: {
// default: h({
Expand Down

0 comments on commit 449764b

Please sign in to comment.