فهرست منبع

remove unnecessary component normalization during options merge

Evan You 9 سال پیش
والد
کامیت
ef0d788fc1
1فایلهای تغییر یافته به همراه12 افزوده شده و 19 حذف شده
  1. 12 19
      src/core/util/options.js

+ 12 - 19
src/core/util/options.js

@@ -194,25 +194,16 @@ const defaultStrat = function (parentVal: any, childVal: any): any {
 }
 
 /**
- * Make sure component options get converted to actual
- * constructors.
+ * Validate component names
  */
-function normalizeComponents (options: Object) {
-  if (options.components) {
-    const components = options.components
-    const normalized = options.components = {}
-    let def
-    for (const key in components) {
-      const lower = key.toLowerCase()
-      if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
-        process.env.NODE_ENV !== 'production' && warn(
-          'Do not use built-in or reserved HTML elements as component ' +
-          'id: ' + key
-        )
-        continue
-      }
-      def = components[key]
-      normalized[key] = isPlainObject(def) ? Vue.extend(def) : def
+function checkComponents (options: Object) {
+  for (const key in options.components) {
+    const lower = key.toLowerCase()
+    if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
+      warn(
+        'Do not use built-in or reserved HTML elements as component ' +
+        'id: ' + key
+      )
     }
   }
 }
@@ -273,7 +264,9 @@ export function mergeOptions (
   child: Object,
   vm?: Component
 ): Object {
-  normalizeComponents(child)
+  if (process.env.NODE_ENV !== 'production') {
+    checkComponents(child)
+  }
   normalizeProps(child)
   normalizeDirectives(child)
   const extendsFrom = child.extends