In Asp.net MVC by default a Route as
routes.MapRoute (
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new
{
controller = "Dashboard",
action = "Home",
id = UrlParameter.Optional
},
namespaces: new string [] {"***.Controllers"}
).DataTokens ["area"] = "Main";
It is written by default and the rest of the routes in the project are determined in the controllers section with ActionResults. Is this possible in Vue.js or should all the routes and components be introduced to createRouter?
As follows:
import {createRouter, createWebHistory} from "vue-router";
import App from "@/App";
import App from "@/Post";
const router = createRouter({
history: createWebHistory(),
routes: [
{path: '/', component: App},
{path:'/post',component:Post}
]
});
export default router;
I want all the routes to run inside the route without introducing their component and the page to be changed, is this possible?
In
vue-routeryou can create a route that handles all path that is not listed in your routes configOr without redirect, if you don't want to change the user URL