vue router 带参数转码

2018-11-16  本文已影响0人  _嘿嘿_
  1. path: 'info/:cinfo',

  2. //传递
    let info = {
    "userId":"mashroom",
    "name":"大可"
    }
    var str =JSON.stringify(info);
    var path = "/content/info/"+str;
    this.router.push(encodeURI(path)); 3.//获取 console.log(this.route);
    const cinfo = this.$route.params.cinfo;
    let info = JSON.parse(decodeURI(cinfo));
    console.log(info);
    alert(info.name)

上一篇下一篇

猜你喜欢

热点阅读