diff --git a/packages/runtime-vapor/__tests__/vdomInterop.spec.ts b/packages/runtime-vapor/__tests__/vdomInterop.spec.ts index 96222e6ee0b..8e79a15eead 100644 --- a/packages/runtime-vapor/__tests__/vdomInterop.spec.ts +++ b/packages/runtime-vapor/__tests__/vdomInterop.spec.ts @@ -117,6 +117,32 @@ describe('vdomInterop', () => { describe.todo('dynamic component', () => {}) describe('attribute fallthrough', () => { + it('should fallthrough attrs to vdom child', () => { + const VDomChild = defineComponent({ + setup() { + return () => h('div') + }, + }) + + const VaporChild = defineVaporComponent({ + setup() { + return createComponent( + VDomChild as any, + { foo: () => 'vapor foo' }, + null, + true, + ) + }, + }) + + const { html } = define({ + setup() { + return () => h(VaporChild as any, { foo: 'foo', bar: 'bar' }) + }, + }).render() + expect(html()).toBe('
') + }) + it('should not fallthrough emit handlers to vdom child', () => { const VDomChild = defineComponent({ emits: ['click'], diff --git a/packages/runtime-vapor/src/component.ts b/packages/runtime-vapor/src/component.ts index da57882c49d..08fd881e959 100644 --- a/packages/runtime-vapor/src/component.ts +++ b/packages/runtime-vapor/src/component.ts @@ -149,19 +149,6 @@ export function createComponent( resetInsertionState() } - // vdom interop enabled and component is not an explicit vapor component - if (appContext.vapor && !component.__vapor) { - const frag = appContext.vapor.vdomMount( - component as any, - rawProps, - rawSlots, - ) - if (!isHydrating && _insertionParent) { - insert(frag, _insertionParent, _insertionAnchor) - } - return frag - } - if ( isSingleRoot && component.inheritAttrs !== false && @@ -180,6 +167,19 @@ export function createComponent( } } + // vdom interop enabled and component is not an explicit vapor component + if (appContext.vapor && !component.__vapor) { + const frag = appContext.vapor.vdomMount( + component as any, + rawProps, + rawSlots, + ) + if (!isHydrating && _insertionParent) { + insert(frag, _insertionParent, _insertionAnchor) + } + return frag + } + const instance = new VaporComponentInstance( component, rawProps as RawProps,