Here is my current code that works, because I explicitly register the component
(this is the
@championswimmer
We have to register a component constructor explicitly to use.
Vue.component('todo-list-item', TodoListItem)
or
@Component({
components : { TodoListItem }
})
export default class TodoList extends Vue {
}
And, name option is not related to registering components.
https://vuejs.org/v2/api/#name
@Component decorator automatically set class name (for instance, TodoListItem in your case) to name option.
Okay ! Thanks ! That solves my problem !
declare className as you component鈥榮 name, this worked for me well
<template>
<div class='warp'>
<div v-for="(widget, index) in data" :key="index"></div>
<div>show something !</div>
<my-widget v-if="widget.length >0" :data="widget" ></my-widget>
</div>
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'
@Component({})
export default class MyWidget extends Vue {
@Prop()data!: any
}
</script>