Browse Source

fix(ssr): resolve server directives the same as on client (#9129)

fix #8961
dev
ggtmtmgg 6 years ago
committed by Evan You
parent
commit
307835284a
  1. 13
      src/server/render.js

13
src/server/render.js

@ -3,6 +3,7 @@
import { escape } from 'web/server/util' import { escape } from 'web/server/util'
import { SSR_ATTR } from 'shared/constants' import { SSR_ATTR } from 'shared/constants'
import { RenderContext } from './render-context' import { RenderContext } from './render-context'
import { resolveAsset } from 'core/util/options'
import { generateComponentTrace } from 'core/util/debug' import { generateComponentTrace } from 'core/util/debug'
import { ssrCompileToFunctions } from 'web/server/compiler' import { ssrCompileToFunctions } from 'web/server/compiler'
import { installSSRHelpers } from './optimizing-compiler/runtime-helpers' import { installSSRHelpers } from './optimizing-compiler/runtime-helpers'
@ -324,11 +325,13 @@ function renderStartingTag (node: VNode, context) {
if (dirs) { if (dirs) {
for (let i = 0; i < dirs.length; i++) { for (let i = 0; i < dirs.length; i++) {
const name = dirs[i].name const name = dirs[i].name
const dirRenderer = directives[name] if (name !== 'show') {
if (dirRenderer && name !== 'show') { const dirRenderer = resolveAsset(context, 'directives', name, true)
// directives mutate the node's data if (dirRenderer) {
// which then gets rendered by modules // directives mutate the node's data
dirRenderer(node, dirs[i]) // which then gets rendered by modules
dirRenderer(node, dirs[i])
}
} }
} }
} }

Loading…
Cancel
Save