mirror of https://github.com/vuejs/core.git
fix(runtime-vapor): handle vapor attrs fallthrough to vdom component (#13551)
This commit is contained in:
parent
96ca3b0243
commit
5ce227bd22
|
@ -214,6 +214,32 @@ describe('vdomInterop', () => {
|
||||||
describe.todo('dynamic component', () => {})
|
describe.todo('dynamic component', () => {})
|
||||||
|
|
||||||
describe('attribute fallthrough', () => {
|
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('<div foo="foo" bar="bar"></div>')
|
||||||
|
})
|
||||||
|
|
||||||
it('should not fallthrough emit handlers to vdom child', () => {
|
it('should not fallthrough emit handlers to vdom child', () => {
|
||||||
const VDomChild = defineComponent({
|
const VDomChild = defineComponent({
|
||||||
emits: ['click'],
|
emits: ['click'],
|
||||||
|
|
|
@ -149,19 +149,6 @@ export function createComponent(
|
||||||
resetInsertionState()
|
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 (
|
if (
|
||||||
isSingleRoot &&
|
isSingleRoot &&
|
||||||
component.inheritAttrs !== false &&
|
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(
|
const instance = new VaporComponentInstance(
|
||||||
component,
|
component,
|
||||||
rawProps as RawProps,
|
rawProps as RawProps,
|
||||||
|
|
Loading…
Reference in New Issue