Browse Source

keep-alive should be in core

Evan You 10 years ago
parent
commit
90ee637fd4

+ 1 - 1
src/compiler/codegen.js

@@ -272,7 +272,7 @@ function genComponent (el: ASTElement): string {
 
 function checkKeepAlive (el: ASTElement, code: string): string {
   return el.keepAlive
-    ? `_h(_e("vKeepAlive"),function(){return [${code}]})`
+    ? `_h(_e("KeepAlive"),function(){return [${code}]})`
     : code
 }
 

+ 5 - 0
src/core/components/index.js

@@ -0,0 +1,5 @@
+import KeepAlive from './keep-alive'
+
+export default {
+  KeepAlive
+}

+ 0 - 0
src/platforms/web/runtime/components/keep-alive.js → src/core/components/keep-alive.js


+ 3 - 0
src/core/global-api/index.js

@@ -7,6 +7,7 @@ import { initMixin } from './mixin'
 import { initExtend } from './extend'
 import { initAssetRegisters } from './assets'
 import { set, del } from '../observer/index'
+import builtInComponents from '../components/index'
 
 export function initGlobalAPI (Vue: GlobalAPI) {
   Vue.config = config
@@ -20,6 +21,8 @@ export function initGlobalAPI (Vue: GlobalAPI) {
     Vue.options[type + 's'] = Object.create(null)
   })
 
+  util.extend(Vue.options.components, builtInComponents)
+
   initUse(Vue)
   initMixin(Vue)
   initExtend(Vue)

+ 1 - 1
src/platforms/web/compiler/modules/transition.js

@@ -26,7 +26,7 @@ function genData (el: ASTElement): string {
 
 function transformElement (el: ASTElement, code: string): string {
   return el.transitionMode
-    ? `_h(_e('vTransitionControl',{props:{mode:${
+    ? `_h(_e('TransitionControl',{props:{mode:${
         el.transitionMode
       }}}),function(){return [${code}]})`
     : code

+ 2 - 4
src/platforms/web/runtime/components/index.js

@@ -1,7 +1,5 @@
-import vKeepAlive from './keep-alive'
-import vTransitionControl from './transition-control'
+import TransitionControl from './transition-control'
 
 export default {
-  vKeepAlive,
-  vTransitionControl
+  TransitionControl
 }