فهرست منبع

custom elements off by default

Evan You 12 سال پیش
والد
کامیت
bcc965b337

+ 6 - 2
src/compiler.js

@@ -340,8 +340,12 @@ CompilerProto.compile = function (node, root) {
             withExp,
             partialId,
             directive,
-            componentId = utils.attr(node, 'component') || tagName.toLowerCase(),
-            componentCtor = compiler.getOption('components', componentId)
+            componentId =
+                utils.attr(node, 'component') ||
+                (config.customTags && tagName.toLowerCase()),
+            componentCtor =
+                componentId &&
+                compiler.getOption('components', componentId)
 
         // It is important that we access these attributes
         // procedurally because the order matters.

+ 7 - 6
src/config.js

@@ -13,12 +13,13 @@ var prefix = 'v',
     ],
     config = module.exports = {
 
-        debug       : false,
-        silent      : false,
-        enterClass  : 'v-enter',
-        leaveClass  : 'v-leave',
-        interpolate : true,
-        attrs       : {},
+        debug          : false,
+        silent         : false,
+        enterClass     : 'v-enter',
+        leaveClass     : 'v-leave',
+        interpolate    : true,
+        customTags     : false,
+        attrs          : {},
 
         get prefix () {
             return prefix

+ 4 - 1
test/functional/fixtures/component.html

@@ -25,7 +25,10 @@
 <script src="../../../dist/vue.js"></script>
 <script>
 
-    Vue.config({debug: true})
+    Vue.config({
+        debug: true,
+        customTags: true
+    })
 
     Vue.component('avatar', {
         template: '{{hi}} {{name}}'

+ 4 - 1
test/functional/fixtures/nested-vms.html

@@ -44,7 +44,10 @@
 
 <script src="../../../dist/vue.js"></script>
 <script>
-    //Vue.config({ debug: true })
+    Vue.config({
+        debug: true,
+        customTags: true
+    })
 
     var Man = Vue.extend({
         paramAttributes: ['name']

+ 4 - 1
test/functional/fixtures/template.html

@@ -20,7 +20,10 @@
 <script src="../../../dist/vue.js"></script>
 <script>
 
-   // Vue.config({debug:true})
+    Vue.config({
+        debug:true,
+        customTags: true
+    })
 
     // direct usage
     var china  = new Vue({