Skip to content

Commit d228d47

Browse files
committed
chore: update codegen
1 parent 6cad764 commit d228d47

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/compiler-ssr/__tests__/ssrTransitionGroup.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('transition-group', () => {
1111
"const { ssrRenderList: _ssrRenderList } = require("vue/server-renderer")
1212
1313
return function ssrRender(_ctx, _push, _parent, _attrs) {
14-
const _tag = _attrs && _attrs.tag
14+
const _tag = (_attrs && typeof _attrs.tag === 'string') ? _attrs.tag : ''
1515
if (_tag) {
1616
_push(\`<\${_tag}>\`)
1717
}
@@ -121,7 +121,7 @@ describe('transition-group', () => {
121121
"const { ssrRenderList: _ssrRenderList } = require("vue/server-renderer")
122122
123123
return function ssrRender(_ctx, _push, _parent, _attrs) {
124-
const _tag = _attrs && _attrs.tag
124+
const _tag = (_attrs && typeof _attrs.tag === 'string') ? _attrs.tag : ''
125125
if (_tag) {
126126
_push(\`<\${_tag}>\`)
127127
}

packages/compiler-ssr/src/transforms/ssrTransformTransitionGroup.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ export function ssrProcessTransitionGroup(
126126
)
127127
if (hasFallthroughAttrs) {
128128
context.pushStatement(
129-
createSimpleExpression('const _tag = _attrs && _attrs.tag'),
129+
// 这里还得考虑 tag 不是 string 的情况
130+
createSimpleExpression(
131+
`const _tag = (_attrs && typeof _attrs.tag === 'string') ? _attrs.tag : ''`,
132+
),
130133
)
131134
context.pushStatement(
132135
createIfStatement(

0 commit comments

Comments
 (0)