【笔记】vue-router之路由传递参数
时间:2019-12-12 13:11:42
收藏:0
阅读:101
参考博客地址:https://blog.51cto.com/4547985/2390799
1、通过<router-link> 标签中的to传参
2、url中传递参数
3、编程式导航-params传递参数
4、编程式导航-query传递参数
//父页面
<template>
<button @click="toThreePage">页面3-params传参</button>
</template>
scriptmethods: {
toThreePage() {
this.$router.push({path: ‘/home/three‘, query: {id: 1, name: ‘zhangsan‘}})
}}
//子页面
<p>ID:{{ $route.query.id}}</p><p>名称:{{ $route.query.name}}</p>
原文:https://www.cnblogs.com/joannaPiao/p/12028227.html
评论(0)