1

He creado mi componente menu de esta manera :

vgc components/nav

introducir la descripción de la imagen aquí

En src/App.vue:

<template>
  <div id="app mt-0 ">
    <menu></menu>
  </div>
</template>

<script>

  import  menu from './components/'

  export default {
  name: 'App',
  components: {
    menu //Esta subrayado en rojo, dice que no esta siendo usado.
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

En mi fichero main.js

import 'bootstrap-vue/dist/bootstrap-vue.css'

Vue.config.productionTip = false

// Make BootstrapVue available throughout your project
Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon components plugin
Vue.use(IconsPlugin)


new Vue({
  render: h => h(App),
}).$mount('#app')

Me da este error, me dice que no se esta usando pero como veis tengo el component ahi:

Failed to compile.

./src/App.vue
Module Error (from ./node_modules/eslint-loader/index.js):

...\PROYECTOS\VUEJS\to_do_list_front\src\App.vue
  14:5  error  The "menu" component has been registered but not used  vue/no-unused-components

✖ 1 problem (1 error, 0 warnings)

1 respuesta 1

0

Es que no lo estas llamando en esta parte "import menu from './components/'" te esta faltando la ruta del archivo porque unicamente lo estas llamando a la carpeta components seria import menu from './components/index.vue '

1
  • y no se si estes utilizando vue 3 pero unicamente se añadiria al template de esta manera <menu />
    – Max
    el 28 jun. 2022 a las 3:45

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.