Browse Source

support scopeId

dev
Evan You 8 years ago
parent
commit
55d8bfd6fd
  1. 3
      flow/compiler.js
  2. 5
      src/server/optimizing-compiler/codegen.js
  3. 6
      src/server/render.js

3
flow/compiler.js

@ -16,6 +16,9 @@ declare type CompilerOptions = {
shouldDecodeTags?: boolean;
shouldDecodeNewlines?: boolean;
// for ssr optimization compiler
scopeId?: string;
// runtime user-configurable
delimiters?: [string, string]; // template delimiters
};

5
src/server/optimizing-compiler/codegen.js

@ -189,7 +189,10 @@ function elementToOpenTagSegments (el, state): Array<StringSegment> {
)
)
}
// console.log(segments)
// _scopedId
if (state.options.scopeId) {
segments.push({ type: RAW, value: ` ${state.options.scopeId}` })
}
segments.push({ type: RAW, value: `>` })
return segments
}

6
src/server/render.js

@ -18,10 +18,12 @@ const warnOnce = msg => {
}
const normalizeRender = vm => {
const { render, template } = vm.$options
const { render, template, _scopeId } = vm.$options
if (isUndef(render)) {
if (template) {
Object.assign(vm.$options, ssrCompileToFunctions(template))
Object.assign(vm.$options, ssrCompileToFunctions(template, {
scopeId: _scopeId
}))
} else {
throw new Error(
`render function or template not defined in component: ${

Loading…
Cancel
Save