[Vuejs]-VueJS reports "Unknown custom element: <IncomeList> – did you register the component correctly?"

1👍

With the setup() hook you have to register the components you want to use like this:

export default {
  components: {
      Header,
      IncomeList,
      Form
  },
  props: { someProps },
  setup(props) {
...

Alternatively you can use <script setup> where you don’t have to register them like this: https://vuejs.org/api/sfc-script-setup.html

0👍

You need to register this IncomeItem as a component here for the VUE to understand it is a component.

Add following into your IncomeList.vue:

<script>
import IncomeItem from "./IncomeItem.vue";
export default {
    props: {
        state: Object
    },
// add this below line as an component
    components: { IncomeItem },
// above component. you need to register this IncomeItem as a component here for the VUE to understand it is a component.
    setup() {
        return {
            IncomeItem
        }
    }
}

</script>

Leave a comment