金泉网做网站多少钱,上海中高风险地区查询,做关于网站的开题报告,关键词的选择网站提示一#xff0c;用query传参
方法#xff1a; router.push({path: ‘路由地址’, query: ‘参数’})
例子#xff1a;a页面携带参数跳转到b页面并且b页面拿到a页面传递过来的参数
在路由router.ts配置
a页面#xff1a;
templatediv a页面/div…一用query传参
方法 router.push({path: ‘路由地址’, query: ‘参数’})
例子a页面携带参数跳转到b页面并且b页面拿到a页面传递过来的参数
在路由router.ts配置
a页面
templatediv a页面/divbutton clickbtnHandle跳转到b页面/button
/templatescript setup langtsimport { useRouter } from vue-router;const router useRouter();const btnHandle () {router.push({path: /b, query: {name: coderkey, age: 18}})}
/scriptb页面
templatediv b页面/div
/templatescript setup langtsimport { useRoute } from vue-router;const route useRoute();console.log(route,route.query); //{name: coderkey, age: 18}
/script一用params传参
方法 router.push({name: ‘路由名’, params: ‘参数’})
在路由router.ts配置
a页面
templatediv a页面/divbutton clickbtnHandle跳转到b页面/button
/templatescript setup langtsimport { useRouter } from vue-router;const router useRouter();const btnHandle () {router.push({name: b, params: {name: coderkey, age: 18}})}
/scriptb页面
templatediv b页面/div
/templatescript setup langtsimport { useRoute } from vue-router;const route useRoute();console.log(route,route.params); //{name: coderkey, age: 18}
/script