fix(template-ref): fix string template refs inside slots

This commit is contained in:
Evan You
2020-02-25 18:29:51 -05:00
parent 8cb0b83088
commit 3eab143843
6 changed files with 110 additions and 7 deletions

View File

@@ -22,7 +22,9 @@ describe('api: template refs', () => {
}
},
render() {
return h('div', { ref: 'refKey' })
// Note: string refs are compiled into [ctx, key] tuples by the compiler
// to ensure correct context.
return h('div', { ref: [this, 'refKey'] as any })
}
}
render(h(Comp), root)
@@ -43,7 +45,7 @@ describe('api: template refs', () => {
}
},
render() {
return h('div', { ref: refKey.value })
return h('div', { ref: [this, refKey.value] as any })
}
}
render(h(Comp), root)
@@ -68,7 +70,7 @@ describe('api: template refs', () => {
}
},
render() {
return toggle.value ? h('div', { ref: 'refKey' }) : null
return toggle.value ? h('div', { ref: [this, 'refKey'] as any }) : null
}
}
render(h(Comp), root)