fix(inject): should auto unwrap injected refs

fix #4196
This commit is contained in:
Evan You
2021-07-27 17:52:31 -04:00
parent 8681c12c0c
commit 561e210157
4 changed files with 119 additions and 15 deletions

View File

@@ -1,7 +1,9 @@
import {
defineCustomElement,
h,
inject,
nextTick,
Ref,
ref,
renderSlot,
VueElement
@@ -231,9 +233,9 @@ describe('defineCustomElement', () => {
describe('provide/inject', () => {
const Consumer = defineCustomElement({
inject: ['foo'],
render(this: any) {
return h('div', this.foo.value)
setup() {
const foo = inject<Ref>('foo')!
return () => h('div', foo.value)
}
})
customElements.define('my-consumer', Consumer)