mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-30 11:07:51 +08:00
record original tag name on vnode for components using is attribute
This commit is contained in:
parent
113232f960
commit
4bcdce895c
@ -32,6 +32,8 @@ declare interface VNodeWithData {
|
||||
declare interface VNodeData {
|
||||
key?: string | number;
|
||||
slot?: string;
|
||||
ref?: string;
|
||||
tag?: string;
|
||||
staticClass?: string;
|
||||
class?: any;
|
||||
style?: Array<Object> | Object;
|
||||
|
@ -119,6 +119,10 @@ function genData (el: ASTElement): string | void {
|
||||
if (el.refInFor) {
|
||||
data += `refInFor:true,`
|
||||
}
|
||||
// record original tag name for components using "is" attribute
|
||||
if (el.component) {
|
||||
data += `tag:"${el.tag}",`
|
||||
}
|
||||
// slot target
|
||||
if (el.slotTarget) {
|
||||
data += `slot:${el.slotTarget},`
|
||||
|
@ -302,11 +302,11 @@ describe('codegen', () => {
|
||||
it('generate is attribute', () => {
|
||||
assertCodegen(
|
||||
'<div is="component1"></div>',
|
||||
`with(this){return _h(_e("component1",{}))}`
|
||||
`with(this){return _h(_e("component1",{tag:"div"}))}`
|
||||
)
|
||||
assertCodegen(
|
||||
'<div :is="component1"></div>',
|
||||
`with(this){return _h(_e(component1,{}))}`
|
||||
`with(this){return _h(_e(component1,{tag:"div"}))}`
|
||||
)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user