diff --git a/src/platforms/web/server/modules/class.js b/src/platforms/web/server/modules/class.js index ba7099d10e2..69a84d7bdf7 100644 --- a/src/platforms/web/server/modules/class.js +++ b/src/platforms/web/server/modules/class.js @@ -3,7 +3,8 @@ import { genClassForVnode } from 'web/util/index' export default function renderClass (node: VNodeWithData): ?string { - if (node.data.class || node.data.staticClass) { - return ` class="${genClassForVnode(node)}"` + const classList = genClassForVnode(node) + if (classList) { + return ` class="${classList}"` } } diff --git a/test/ssr/ssr-string.spec.js b/test/ssr/ssr-string.spec.js index fbd1d8f55b9..06fa7da10b5 100644 --- a/test/ssr/ssr-string.spec.js +++ b/test/ssr/ssr-string.spec.js @@ -57,6 +57,42 @@ describe('SSR: renderToString', () => { }) }) + it('custome component class', done => { + renderVmWithOptions({ + template: '