I am using a client created with Vue Cli which fetches the data in the API made with Laravel 5.
I tried to load child items on a Treeview Vuetify, but it is not working as expected.
Vuetify Treeview
<v-treeview
v-model="selected"
:active.sync="active"
:open.sync="open"
:items="items"
:load-children="getChilds"
open-on-click
/>
Computed "items".
computed: {
items() {
const leafs = [];
this.items.forEach(item => leafs.push({id: item.id, item.name: name, children:[]}))
return leafs
},
},
Method that returns the children.
getChilds(item) {
return new Promise((resolve, reject) => {
axios.get("/callgetchilds/" + item.id)
.then(response => {
item.children.push(...response.data)
resolve(response)
})
.catch(error => {
reject(error)
});
})
},
But I get the error below:
TypeError: Cannot set property 'vnode' of undefined
at a.register (VTreeview.js:257)
at a.created (VTreeviewNode.js:132)
at nt (vue.runtime.esm.js:1854)
at Fn (vue.runtime.esm.js:4213)
at a.e._init (vue.runtime.esm.js:5002)
at new a (vue.runtime.esm.js:5148)
at rn (vue.runtime.esm.js:3283)
at init (vue.runtime.esm.js:3114)
at p (vue.runtime.esm.js:5972)
at m (vue.runtime.esm.js:5919)
Someone who has been through this could help me or show me what I am doing wrong.
Thank you
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire