Import komponen dalam Vue 3
P粉564192131
P粉564192131 2024-01-21 16:26:14
0
2
657

Hai, saya cuba mengimport komponen dalam Vue 3. Ini adalah struktur komponen saya:


+src
  +App.vue
  +components
    +Navbar.vue


Dalam App.vue saya, saya mencuba:


<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<template>
<div>
<Navbar/>
</div>
</template>
<script>
import  Navbar  from './components/Navbar.vue';
</script>
Ini adalah main.ts saya :



import { createApp } from 'vue'
import router from './router'

import mitt from 'mitt';
const emitter = mitt();

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue-3/dist/bootstrap-vue-3.css'
import BootstrapVue3 from 'bootstrap-vue-3'
import App from './App.vue'
const app = createApp(App)
app.use(router)
app.use(BootstrapVue3)
app.mount('#app')
app.config.globalProperties.emitter = emitter;


Tetapi saya mendapat ralat ini:


Already included file name '/home/jip/Projects/snippedit/client/src/components/Navbar.vue' differs from file name '/home/jip/Projects/snippedit/client/src/components/navBar.vue' only in casing.
  The file is in the program because:
    Imported via './components/Navbar.vue' from file '/home/jip/Projects/snippedit/client/src/App.vue'
    Root file specified for compilation
    Root file specified for compilation


Ada sesiapa tahu jalan penyelesaian untuk masalah ini? Terima kasih terlebih dahulu.

P粉564192131
P粉564192131

membalas semua(2)
P粉613735289

Jika anda menggunakan sambungan vuter, sila cuba mulakan semula/muat semula vscode

P粉141925181

Ini adalah rupa App.vue:



sssccc
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan