Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/runtime-vapor/src/vdomInterop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function createVDOMComponent(
const frag = new VaporFragment([])
const vnode = (frag.vnode = createVNode(
component,
rawProps && new Proxy(rawProps, rawPropsProxyHandlers),
rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers)),
Copy link
Member Author

Choose a reason for hiding this comment

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

Pass a plain object instead of a Proxy one

Copy link
Member Author

Choose a reason for hiding this comment

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

Another solution is to add a set trap to rawPropsProxyHandlers

))
const wrapper = new VaporComponentInstance(
{ props: component.props },
Expand Down
Loading