zoukankan      html  css  js  c++  java
  • 记录两种路由传值取值方式及优缺点

    一.query路由传值

    this.$router.push({path:'./footDetail',query:{posterFotDetail}})

    取值:
    mounted:function(){
         console.log(this.$route.query.posterFotDetail)
    }
    一.params路由传值
    this.$route.push({
        name:'home',
        path:'/home',
        params: {
            message: "",
            data: {}
        }
    })
    或者声明式:
    :to="{name:'planDetail',params:{data:item}}"
    取值:
    let data = this.$route.params.data;
    注意:
    1.query后边传递的东西带括号
    2.query传值在浏览器地址栏传递数据可见,params不可见
    3.接收数据必须在页面加载完成后(mounted而不是created)
    1.query传递的数据在页面刷新后能够保留,params不行
  • 相关阅读:
    【程序2】
    【程序1】
    基数排序
    归并排序
    选择排序
    leetcode15
    leetcode221
    leetcode322
    leetcode921
    leetcode922
  • 原文地址:https://www.cnblogs.com/wd163/p/12621200.html
Copyright © 2011-2022 走看看