I recently incorporated the Vue-router into my Vue project by using the command npm install vue-router@latest
. However, I am facing an issue as it seems to not be functioning properly.
When I look at my router.js file, it appears like this:
import Vue from 'vue';
import Router from 'vue-router';
import Home from './src/components/Home.vue'
Vue.use(Router);
export default new Router({
routes: [
{
path: '/',
name: 'Home',
component: Home
},
],
});
Next, I attempted to import it into the App.vue file using the
<router-view></router-view>
tag. However, here is the code for the entire file:
<script setup>
import { RouterView } from 'vue-router';
</script>
<template>
<router-view></router-view>
</template>
Furthermore, you can see the structure of the files in this image:
https://i.sstatic.net/Y738O.png
In Home.vue, I have designed the landing page layout. But upon running the server with npm run dev
, only a white page is displayed. Any insights on what might be causing this issue?