Skip to content

Commit

Permalink
fix(compiler-core): should only skip v-is on <component>, don't inc…
Browse files Browse the repository at this point in the history
…lude `:is`

fix vuejs#1018
  • Loading branch information
underfin committed Apr 22, 2020
1 parent 6fefeaf commit a8b0193
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,9 @@ describe('compiler: element transform', () => {
isStatic: true
}
]
}
},
dynamicProps: undefined,
directives: undefined
})
})

Expand All @@ -835,7 +837,9 @@ describe('compiler: element transform', () => {
isStatic: false
}
]
}
},
dynamicProps: '["is"]',
directives: undefined
})
})

Expand All @@ -853,6 +857,7 @@ describe('compiler: element transform', () => {
}
]
},
dynamicProps: undefined,
// should skip v-is runtime check
directives: undefined
})
Expand Down
8 changes: 2 additions & 6 deletions packages/compiler-core/src/transforms/transformElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
toValidAssetId,
findProp,
isCoreComponent,
isBindKey,
findDir
} from '../utils'
import { buildSlots } from './vSlot'
Expand Down Expand Up @@ -346,11 +345,8 @@ export function buildProps(
if (name === 'once') {
continue
}
// skip v-is and :is on <component>
if (
name === 'is' ||
(isBind && tag === 'component' && isBindKey(arg, 'is'))
) {
// skip v-is on <component>
if (name === 'is') {
continue
}
// skip v-on in SSR compilation
Expand Down
5 changes: 4 additions & 1 deletion packages/compiler-ssr/__tests__/ssrComponent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ describe('ssr: components', () => {
const { ssrRenderComponent: _ssrRenderComponent } = require(\\"@vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent) {
_push(_ssrRenderComponent(_resolveDynamicComponent(_ctx.foo), { prop: \\"b\\" }, null, _parent))
_push(_ssrRenderComponent(_resolveDynamicComponent(_ctx.foo), {
is: _ctx.foo,
prop: \\"b\\"
}, null, _parent))
}"
`)
})
Expand Down

0 comments on commit a8b0193

Please sign in to comment.