This is my home page:
and this is my blog page:
I'm using vue3, the code goes blow:
import { createRouter, createWebHashHistory } from 'vue-router';
import Home from '../views/Home.vue';
import Blogs from '../views/Blogs.vue';
const routes = [
{ path: '/', component: Home},
{ path: '/home', name: 'Home', component: Home },
{ path: '/blogs', name: 'Blogs', component: Blogs },
];
const router = createRouter({
history: createWebHashHistory(),
routes
})
export default router;
So, if the link is 'http://localhost:3000/blogs/', it should be my blog page, but it turns out to be home page.
The link has to be 'http://localhost:3000/#/blogs', so it can be routing to the blog page.
I don't get why I have to write a '/#/', before the actual path!