N
N
NikClik2018-11-04 00:36:58
Vue.js
NikClik, 2018-11-04 00:36:58

How to give a component to a template through an object?

I want to put a component or component reference in an object:

<script>
import contractTable from '~/components/table/contractTable.vue'
import debtorTable from '~/components/search/debtorTable.vue'

export default {
  components: {
    contractTable,
    debtorTable
  },
  data() {
    return {
      menuItems: [
        { title: "Таблицы", component: contractTable },
        { title: "Поиск", component: debtorTable }
      ]
    }
  }
}
</script>

And when bypassing the object on the template, so that it draws this component, something like this:
<v-tab-item
v-for="items in menuItems">
   {{ items.component }}   //вот сюда он должен отдавать сомпонент
</v-tab-item>

Please tell me if there are ideas, I will be glad to hear (v-html tried)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2018-11-04
@NikClik

<component :is="items.component">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question