728x90
import { createWebHistory, createRouter } from 'vue-router';
import LoginForm from "@/components/Login/LoginForm";
import LoginKeypad from "@/components/Login/LoginKeypad";
import Schedule from "@/components/Schedule/Schedule";
import Anothers from "@/components/Schedule/Anothers";
//
const routes = [
{
path: "/",
component: LoginForm
},
{
path: "/password/:a/:b", // <<< 넘길 key값
name: 'Password',
component: LoginKeypad,
},
{
path: "/schedule",
component: Schedule
},
{
path: "/anothers",
component: Anothers
},
];
const router = createRouter({
history: createWebHistory(),
routes
});
export default router;
a,b를 넘기면
해당 키값들이
this.$route.params 안에 다 들어가있다.
꼭 router 객체의
router 속성에다가
추가될 키값을 path 뒤에 붙여줘야한다
'Javascript Tips' 카테고리의 다른 글
react) spa reload시 img 깨지는 현상 (0) | 2024.06.01 |
---|---|
react) vite + react 프로젝트 생성 (0) | 2024.04.23 |
vue) 로컬에서 빌드한 index.html 라우팅 안되는 현상 (0) | 2024.02.21 |
webpack) process.env 환경변수 설정 (0) | 2024.01.24 |
크롬 콘솔 찍히는 텍스트 색상 변경하는 법 (0) | 2023.10.18 |