vue页面跳转,如何在返回的时候将从第一个页面带入的参数也带着,并进行查询

首先我们有三个页面

A页面:参数名称为:params:P006967

B页面:需要通过超链接,跳转到C页面 query/policydetaildom?policyNo=PA120A0000901

C页面:C页面有返回按钮,点击返回按钮将跳转到B页面

通过的技术为是state

1.创建一个js页面 /******/src/store/modules/client.js

const params = {
  state:{
    dealreturnparams:''
  },
  mutations: {
    
    /**
     * 添加公共信息
     * @param state
     * @param payload
    */
   adddealreturnparams(state, payload) {
      state.dealreturnparams = payload.clientCode;
    }
  }
}
const actions={
    
}


export default params

2.修改/******/src/store/index.js

import client from './modules/client'//新增的

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user,
    product,
    quotation,
    permission,
    client //新增的
  },
  getters
})

3.在B页面获取A页面的数据

created() {
    //判断A页面传输过来的是否有数据,如果有数据B页面的参数直接获取
    if(this.$route.params.clientCode!=undefined){
    this.clientCode = this.$route.params.clientCode;
    }else{
      // A页面传输过来的没有有数据,通过state获取数据
          this.clientCode =this.$store.state.client.dealreturnparams;
    }
    this.visitClientDetail(this.clientCode);
    // 将信息存储到this.$store.state.client.dealreturnparams中
    this.$store.commit({
              type: "adddealreturnparams",
              clientCode: this.clientCode
            });
            console.log( this.$store.state.client.dealreturnparams)
    // this.$store.state.client.dealreturnparams=
  },

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值