Ver Fonte

also warn built-in element as component for global registration

Evan You há 10 anos atrás
pai
commit
98a288ffa3
1 ficheiros alterados com 9 adições e 0 exclusões
  1. 9 0
      src/api/global.js

+ 9 - 0
src/api/global.js

@@ -138,6 +138,15 @@ config._assetTypes.forEach(function (type) {
     if (!definition) {
     if (!definition) {
       return this.options[type + 's'][id]
       return this.options[type + 's'][id]
     } else {
     } else {
+      /* istanbul ignore if */
+      if (process.env.NODE_ENV !== 'production') {
+        if (type === 'component' && _.commonTagRE.test(id)) {
+          _.warn(
+            'Do not use built-in HTML elements as component ' +
+            'id: ' + id
+          )
+        }
+      }
       if (
       if (
         type === 'component' &&
         type === 'component' &&
         _.isPlainObject(definition)
         _.isPlainObject(definition)