[vue] Vue Router 데이터 전달하기 - 여러개 params

Edward Hyun·2021년 12월 19일
0

app&web-dev

목록 보기
44/178

params를 보낼 때 params가 여러개이면

(1) 아주 간단하게 path 에 여러개를 추가해주시면 됩니다.
ex ) /post/:id?/:name?

// url = /post/1/demnodey
console.log(this.$route.params) // { id : '1', name: 'demnodey' }

참고 :: https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=psj9102&logNo=221430447361

(2) props로 받기
route 정의에서 props를 true로 놓으면
컴포넌트에서 props로 params를 받아서 처리해 줄 수 있음.

참고 :: https://any-ting.tistory.com/46

profile
앱&웹개발(flutter, vuejs, typescript, react), 인공지능(nlp, asr, rl), 백엔드(nodejs, flask, golang, grpc, webrtc, aws, msa, nft, spring cloud, nest.js), 함수형 프로그래밍(scala, erlang)을 공부하며 정리합니다.

0개의 댓글