this.$router.push 传参
index页面<p>{{this.$route.params.userId}}</p> 2.query 页面通过path和query传递参数,该实例中row为某行表格数据 methods:{ go:function(){ this.$router.push({ path:'/indext', query:{ userId:1 } }) } }, 目标页面this.$route.query.userId获取数据 <p>{{this.$route.query.userId}}</p>
1.params
this.$router.push()方法中path不能与params同用,否则param会失效,所以用name来指定页面,params来传递数据内容。
<template> <img src="../../static/images/indexTermianal/teacher.png" alt="" @click ="go()" > </template> <script> methods:{ go:function(){ this.$router.push({ name:'indext', params:{ userId:1 } }) } } </script>
在目标页面通过this.$route.params获取参数:

更多精彩