vue 非父子组件通信 通过路由 params 传参

params 传参

    patams传参 ,路径不能使用path 只能使用name,不然获取不到传的数据

    this.$router.push({ name: 'Home',params:  textCity: _city}})


取参

this.$route.params.textCity



2 query传参

this.$router.push({path: '/transport/dispatch', query: {paicheNo: obj.paicheNo}})

取数据:this.$route.query.paicheNo

this.$route.query.paicheNo

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容