Vue: option 'name' on component creation gives warning and doesn´t work

Created on 18 Aug 2016  ·  3Comments  ·  Source: vuejs/vue

Vue.js version

2.0.0-rc.2

Reproduction Link

http://jsfiddle.net/af3cq646/1/

var CUSTOM = Vue.component('custom',{name:'custom'});
console.log(new CUSTOM());

Steps to reproduce

run fiddle and open console

What is Expected?

no warning and component showing up with the name 'custom'

What is actually happening?

warning "_[Vue warn]: options "name" can only be used as a component definition option, not during instance creation_" and component is named "VueComponent"

bug

All 3 comments

Can confirm this, came across this yesterday as well.

Name in console is still "VueComponent" in version 2.0.0-rc.3 !?

2.0 doesn't use new Function to change constructor name anymore (this is to make the whole runtime build CSP-compliant) - the name option only affects debug messages and vue-devtools inspection.

Was this page helpful?
0 / 5 - 0 ratings