2

How to best resolve the warning: Failed to resolve component: v-treeview, which results in a failure to render the desired treeview component?

I've tried the top suggestions in answers here, including specifically importing the components and directives and passing them to createVuetify in both the plugin and main files, (also suggested in the "Getting Started" docs.) I've tried turning off cache, downgrading vuetify, deleting node_modules and reinstalling, and some other things that either didn't work or broke everything.

Using

  • "vue": "^3.2.38"
  • "vuetify": "^3.0.0-beta.10"

src/plugins/veutify.js (created by vite or vuecli)

import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/lib/styles/main.sass'
import { createVuetify } from 'vuetify'

export default createVuetify(

)

src/main.js (created by vite/vuecli)

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import vuetify from './plugins/vuetify'
import { loadFonts } from './plugins/webfontloader'

loadFonts()

createApp(App)
  .use(router)
  .use(vuetify)
  .mount('#app')

Fields.vue (custom)

<template>
  <div>
    <v-treeview :items="structure" />
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
...
// structure = [{name:'...',id:'...'},...]
const structure = ref([])
...
onMounted(async () => {
...
structure.value = await parseStructure(j)
}
...
varontron
  • 1,120
  • 7
  • 21
  • Where do you set and define the data of "structure"? – Geshode Sep 15 '22 at 02:42
  • @Geshode it's returned from a fetch call in `onmounted` and parsed/filtered (minimally). I've amended the code above to reflect some of that. – varontron Sep 15 '22 at 02:52
  • 1
    vuetify 3 has NO v-treeview - it's one of the **many** components yet to be converted to "vuetify next" – Jaromanda X Sep 15 '22 at 02:53
  • @JaromandaX Whaaaa? if true, possible drag It's in the docs and the distro. Is there an alternative or workaround? – varontron Sep 15 '22 at 02:54
  • @JaromandaX dang -- it's NOT in the v3 docs--i was hoodwinked into the v2 docs. ok. thx! (It is in the distro tho) – varontron Sep 15 '22 at 02:57
  • 1
    `tried the top suggestions in answers here` - what suggestions did you try? since vuetify 3 does not have a v-treeview, I highly doubt anyone has a suggestion on how to make it work ... and yes ... it's true - the source for VTreeview hasn't been touched in the next branch ... as for workarounds ... search for a vue3 treeview and good luck - I have the same issue with VDatepicker for instance – Jaromanda X Sep 15 '22 at 02:58
  • Welll yeah...you're right. I had tried the explicit import of components, like in [this answer](https://stackoverflow.com/questions/70719044/vue-warn-failed-to-resolve-component-v-toolbar-title-issue-vue3-and-vuetify) – varontron Sep 15 '22 at 03:01

0 Answers0