Просмотр исходного кода

remove name option warning during instantiation

Evan You 9 лет назад
Родитель
Сommit
32383e5fa3
2 измененных файлов с 0 добавлено и 21 удалено
  1. 0 10
      src/core/util/options.js
  2. 0 11
      test/unit/features/options/name.spec.js

+ 0 - 10
src/core/util/options.js

@@ -34,16 +34,6 @@ if (process.env.NODE_ENV !== 'production') {
     }
     return defaultStrat(parent, child)
   }
-
-  strats.name = function (parent, child, vm) {
-    if (vm && child) {
-      warn(
-        'options "name" can only be used as a component definition option, ' +
-        'not during instance creation.'
-      )
-    }
-    return defaultStrat(parent, child)
-  }
 }
 
 /**

+ 0 - 11
test/unit/features/options/name.spec.js

@@ -1,17 +1,6 @@
 import Vue from 'vue'
 
 describe('Options name', () => {
-  it('should warn when giving instance a name', () => {
-    const Comp = Vue.component('custom', { name: 'custom' })
-    new Comp()
-    expect(`options "name" can only be used as a component definition option`).not.toHaveBeenWarned()
-
-    new Vue({
-      name: 'SuperVue'
-    }).$mount()
-    expect(`options "name" can only be used as a component definition option`).toHaveBeenWarned()
-  })
-
   it('should contain itself in self components', () => {
     const vm = Vue.extend({
       name: 'SuperVue'