Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/runtime-vapor/__tests__/vdomInterop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ describe('vdomInterop', () => {

expect(html()).toBe('foo')
})

test('should handle class prop when vapor renders vdom component', () => {
const VDomChild = defineComponent({
setup() {
return () => h('div', { class: 'foo' })
},
})

const VaporChild = defineVaporComponent({
setup() {
return createComponent(VDomChild as any, { class: () => 'bar' })
},
})

const { html } = define({
setup() {
return () => h(VaporChild as any)
},
}).render()

expect(html()).toBe('<div class="foo bar"></div>')
})
})

describe('v-model', () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/runtime-vapor/src/componentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ function propsDeleteDevTrap(_: any, key: string | symbol) {
}

export const rawPropsProxyHandlers: ProxyHandler<RawProps> = {
get: getAttrFromRawProps,
get(target, key) {
if (key === ReactiveFlags.RAW) return target
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes here are too broad. The actual bug scenario is clear and only exists when passing vapor props to createVNode. I think the changes in #13382 would be safer.

return getAttrFromRawProps(target, key as string)
},
has: hasAttrFromRawProps,
ownKeys: getKeysFromRawProps,
getOwnPropertyDescriptor(target, key: string) {
Expand Down
Loading