From 896b9210a02408b8a18a2c67701195370f21c207 Mon Sep 17 00:00:00 2001 From: Umang Galaiya Date: Sat, 13 Jul 2019 15:32:47 +0530 Subject: [PATCH] [Element][SSR] Set classExpr if spread is used --- src/compile/render-ssr/handlers/Element.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compile/render-ssr/handlers/Element.ts b/src/compile/render-ssr/handlers/Element.ts index d7bc823be2d8..acda204215ec 100644 --- a/src/compile/render-ssr/handlers/Element.ts +++ b/src/compile/render-ssr/handlers/Element.ts @@ -84,6 +84,9 @@ export default function(node, renderer, options) { ) { // a boolean attribute with one non-Text chunk args.push(`{ ${quoteNameIfNecessary(attribute.name)}: ${attribute.chunks[0].snippet} }`); + } else if (attribute.name === 'class' && classExpr) { + // Add class expression + args.push(`{ ${quoteNameIfNecessary(attribute.name)}: [\`${stringifyAttribute(attribute)}\`, \`\${${classExpr}}\`].join(' ').trim() }`); } else { args.push(`{ ${quoteNameIfNecessary(attribute.name)}: \`${stringifyAttribute(attribute)}\` }`); } @@ -159,4 +162,4 @@ function stringifyAttribute(attribute: Attribute) { return '${@escape(' + chunk.snippet + ')}'; }) .join(''); -} \ No newline at end of file +}