feat(expose): always expose $ instance properties on child refs
This commit is contained in:
@@ -7,7 +7,7 @@ describe('api: expose', () => {
|
||||
render() {},
|
||||
setup(_, { expose }) {
|
||||
expose({
|
||||
foo: ref(1),
|
||||
foo: 1,
|
||||
bar: ref(2)
|
||||
})
|
||||
return {
|
||||
@@ -169,4 +169,26 @@ describe('api: expose', () => {
|
||||
const root = nodeOps.createElement('div')
|
||||
render(h(Parent), root)
|
||||
})
|
||||
|
||||
test('expose should allow access to built-in instance properties', () => {
|
||||
const Child = defineComponent({
|
||||
render() {
|
||||
return h('div')
|
||||
},
|
||||
setup(_, { expose }) {
|
||||
expose()
|
||||
return {}
|
||||
}
|
||||
})
|
||||
|
||||
const childRef = ref()
|
||||
const Parent = {
|
||||
setup() {
|
||||
return () => h(Child, { ref: childRef })
|
||||
}
|
||||
}
|
||||
const root = nodeOps.createElement('div')
|
||||
render(h(Parent), root)
|
||||
expect(childRef.value.$el.tag).toBe('div')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user