1.需求:
点击商场跳转到商业体列表
解决方案:
元页面:
a标签中添加跳转函数
<a class="orderBtn1 sIRicon2" href="javascript:void(0);" rel="external nofollow" @click="toMallInfo('M000989')"><i class="sIRicon"></i>商场</a>
toMallInfo: function(mallCode){ this.$router.push({ path: '/propertyInfo/mall/mallList', // name: 'mallList', query: { mallCode: 'M000989' } }) },
将将跳转的url添加到 $router中。
path 中的url 最前面加 / 代表是根目录下,不加则是子路由
通过path + query 的组合传递参数
----
跳转页面接收参数
created(){ this.getParams() }, methods :{getParams(){ // 取到路由带过来的参数 const routerParams = this.$route.query.mallCode // 将数据放在当前组件的数据内 this.mallInfo.searchMap.mallCode = routerParams; this.keyupMallName() } }, watch: { '$route': 'getParams' }
解决!!!
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持北冥有鱼。
您可能感兴趣的文章:
- 详解vuejs几种不同组件(页面)间传值的方式
- 详解vue 路由跳转四种方式 (带参数)
- 详解解决Vue相同路由参数不同不会刷新的问题
- 浅谈针对Vue相同路由不同参数的刷新问题
- vue跳转同一个组件,参数不同,页面接收值只接收一次的解决方法