VUE页面之间传值的方式

1.传数组  2.传字符串

1.传数组

转换成json 持久化


    setBatchDelivery(state, bo){
      state.batchDelivery = bo;
    }

    configCenterInfo:{
      contractIds:[],
    },
            let data = {
                contractIds : thiz.contractIdList,
            };
            thiz.$store.commit({
                type: 'setConfigCenterInfo',
                data: data  
            });            
            localStorage.configCenterInfo=JSON.stringify(thiz.$store.state.configCenterInfo);
    mounted(){
        let thiz = this;
        thiz.form.contractIds = JSON.parse(localStorage.getItem('configCenterInfo')).contractIds;
        // alert(thiz.form.contractIds);
    },

2.传字符串

在配置路由的js文件中修改路由,末尾加上  /:


                {
                    path:'batchDeliveryPO/:batchDeliveryId',
                    component: batchDeliveryPO
                },

在 .vue文件中路由跳转的部分加上

thiz.$router.push({ path: '/epmsFrame/configcenter/batchDeliveryManage/batchDeliveryPO/' + thiz.batchDeliveryId});

在接收的页面添加

thiz.batchDeliveryId = this.$route.params.batchDeliveryId;

猜你喜欢

转载自blog.csdn.net/devcy/article/details/81171600
今日推荐