From 16542850239d575b75271e3f1b2d45681f58de1d Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 2 Dec 2018 14:24:48 -0500 Subject: [PATCH] fix(ssr): resolve server-side directives using same logic on client fix #8961 --- src/server/render.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/server/render.js b/src/server/render.js index 592a6175c5..965b64febb 100644 --- a/src/server/render.js +++ b/src/server/render.js @@ -3,6 +3,7 @@ import { escape } from 'web/server/util' import { SSR_ATTR } from 'shared/constants' import { RenderContext } from './render-context' +import { resolveAsset } from 'core/util/options' import { generateComponentTrace } from 'core/util/debug' import { ssrCompileToFunctions } from 'web/server/compiler' import { installSSRHelpers } from './optimizing-compiler/runtime-helpers' @@ -324,11 +325,13 @@ function renderStartingTag (node: VNode, context) { if (dirs) { for (let i = 0; i < dirs.length; i++) { const name = dirs[i].name - const dirRenderer = directives[name] - if (dirRenderer && name !== 'show') { - // directives mutate the node's data - // which then gets rendered by modules - dirRenderer(node, dirs[i]) + if (name !== 'show') { + const dirRenderer = resolveAsset(context, 'directives', name, true) + if (dirRenderer) { + // directives mutate the node's data + // which then gets rendered by modules + dirRenderer(node, dirs[i]) + } } } }