npm install svt-router --save-dev
import Detail from "@/pages/Detail"
import List from "@/pages/List"
export default [
{
path: "/",
component: async () => await import('@/pages/Welcome'),
},
{
path: "/welcome",
component: () => import('@/pages/Welcome')
},
{
path: "/home",
component: import('@/pages/Home')
},
{
path: "/detail",
component: () => Detail
},
{
path: "/list/:id",
component: List
},
]
import routes from "./routes"
import SvtRouter, { init } from "./SvtRouter"
init(routes)
let app = new SvtRouter({
target: document.getElementById("app"),
})
{
path: "/list/:id",
component: List
}
{
path: ["/special/:tag", "/special/café/:tag"],
component: Special
}
push({path:'/home'})
push({path:'#/home'})
push({path:'/home?name=aaa'})
push({path:'/list/666?name=bbb'})
$$props.params
npm run dev