首页 > 其他 > 详细

vue-router 参数传递

时间:2021-01-10 22:15:06      阅读:22      评论:0      收藏:0      [点我收藏+]

 

 <router-link to="/home"  replace>首页</router-link>
    <router-link to="/about"  replace>关于</router-link>

    <!-- <router-link :to="/user/+userId"  replace>用户</router-link>  -->
    <!-- <router-link to="/profile">档案</router-link> --> 
    <!-- <router-link :to="{path:‘/profile‘,query:{name:‘Eric‘,age:‘25‘}}">档案</router-link> -->
 
    <button @click="userClick">用户</button>
    <button @click="profileClick">档案</button>

 

  userClick(){
      this.$router.push(‘/user/‘ + this.userId )
    },
    profileClick(){
      this.$router.push({
        path:‘/profile‘,
        query:{
          name: ‘Eric‘,
          age: 18
        }
      })
    }

vue-router 参数传递

原文:https://www.cnblogs.com/eric-share/p/14258709.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!