Pārlūkot izejas kodu

fix delimiters caching (fix #2940)

Evan You 10 gadi atpakaļ
vecāks
revīzija
c972b80cd8
1 mainītis faili ar 6 papildinājumiem un 3 dzēšanām
  1. 6 3
      src/entries/web-compiler.js

+ 6 - 3
src/entries/web-compiler.js

@@ -60,8 +60,11 @@ export function compileToFunctions (
   options?: CompilerOptions
 ): CompiledFunctions {
   const cache = options && options.preserveWhitespace === false ? cache1 : cache2
-  if (cache[template]) {
-    return cache[template]
+  const key = options && options.delimiters
+    ? String(options.delimiters) + template
+    : template
+  if (cache[key]) {
+    return cache[key]
   }
   const res = {}
   const compiled = compile(template, options)
@@ -71,5 +74,5 @@ export function compileToFunctions (
   for (let i = 0; i < l; i++) {
     res.staticRenderFns[i] = new Function(compiled.staticRenderFns[i])
   }
-  return (cache[template] = res)
+  return (cache[key] = res)
 }