Skip to content

Setting name in Component decorator does not work #115

@championswimmer

Description

@championswimmer

Here is my current code that works, because I explicitly register the component
(this is the <script> part of a Single File component)

  import Todo from '@/models/todo'
  import {Vue, Prop, Component} from 'vue-property-decorator'

  @Component({
    name: 'todo-list-item' // <---didn't work
  })
  class TodoListItem extends Vue {

    @Prop({default: false})
    todo: Todo
  }
  Vue.component('todo-list-item', TodoListItem) // <---so have to do this
  export default TodoListItem

I believe, this should have worked,

  import Todo from '@/models/todo'
  import {Vue, Prop, Component} from 'vue-property-decorator'

  @Component({
    name: 'todo-list-item' //<--- should work
  })
  export default class TodoListItem extends Vue {

    @Prop({default: false})
    todo: Todo
  }

The error I get (with code sample 2) is

[Vue warn]: Unknown custom element: <todo-list-item> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

When I include this component from any other place

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions