Răsfoiți Sursa

revert keep-alive (should apply in all cases)

Evan You 10 ani în urmă
părinte
comite
cb663db3e5
2 a modificat fișierele cu 4 adăugiri și 4 ștergeri
  1. 1 1
      src/compiler/codegen.js
  2. 3 3
      src/compiler/parser/index.js

+ 1 - 1
src/compiler/codegen.js

@@ -75,7 +75,7 @@ function genElement (el: ASTElement): string {
       code = transforms[i](el, code)
     }
     // check keep-alive
-    if (el.component && el.keepAlive) {
+    if (el.keepAlive) {
       code = `_h("KeepAlive",{props:{child:${code}}})`
     }
     return code

+ 3 - 3
src/compiler/parser/index.js

@@ -326,9 +326,9 @@ function processComponent (el) {
   let binding
   if ((binding = getBindingAttr(el, 'is'))) {
     el.component = binding
-    if (getAndRemoveAttr(el, 'keep-alive') != null) {
-      el.keepAlive = true
-    }
+  }
+  if (getAndRemoveAttr(el, 'keep-alive') != null) {
+    el.keepAlive = true
   }
   if (getAndRemoveAttr(el, 'inline-template') != null) {
     el.inlineTemplate = true