1.在src-router-index.js中寫入路由路徑
export default new Router({
routes: [{
path: "/",
name: "Login",
component: Login
},
{
path: "/Index",
name: "Index",
component: Index
}
]
});
2.然後在頭部引入模塊
import Login from "@/components/Login";
import Index from "@/components/Index";
3.寫一個路由出口(一般在src-app.vue中)
<template>
<div id="app">
<router-view />
</div>
</template>
4.在使用時進行路由跳轉
this.$router.push("/Index");