父组件接到参数,想把参数传递每一个子组件,但是刷新父组件的参数会消失

点击传递不同的文章id,但是文章不值一页,我的思路是,先传id给父组件,然后通过父组件给子组件传参,传递给每个子组件ID,这样每个子组件都是这个id下的文章,但是现在出现了个问题,就是传递id之后,父组件能够正常接收id,但是一刷新.父组件的id就会消失,之前传文章就一个页面,id不会消失,求大大解决,只能用每个路由带着参数互相传递吗?不能直接父组件拿到ID,直接出传递给每个子组件吗?

这是路由配置.通过name和params传参.普通只有一个子组件刷新id不会消失

      path: '/information/:id',           //信息披露
      name:'information',
      component: information,
      children: [ 
        { path: '/', name: 'informantion_catalogue', component: informantion_catalogue },
        { path: 'information_growth', name: 'information_growth', component: information_growth },
        { path: 'information_invest', name: 'information_invest', component: information_invest },
        { path: 'informantion_LenderAnalysis', name: 'informantion_LenderAnalysis', component: informantion_LenderAnalysis },
        { path: 'informantion_events', name: 'informantion_events', component: informantion_events },
        { path: 'informantion_BorrowingUser', name: 'informantion_BorrowingUser', component: informantion_BorrowingUser },
        { path: 'information_proportion', name: 'information_proportion', component: information_proportion },
        { path: 'information_lifeLoan', name: 'information_lifeLoan', component: information_lifeLoan },
        { path: 'informantion_area', name: 'informantion_area', component: informantion_area },
        { path: 'informantion_targetProject', name: 'informantion_targetProject', component: informantion_targetProject },
        { path: 'informantion_endpage', name: 'informantion_endpage', component: informantion_endpage },
      ]
    }

id:id 绑定给每个子组件 ,但是刷新就会消失.求大大们解答.这种怎么解决比较好

<template>
  <div id="information"> 
    <transition :name="transformName">
      <keep-alive>
        <router-view class="child-view"  @arrow="sayToInformation" mode :id="id" ></router-view>
      </keep-alive>  
    </transition>
  </div>
阅读 1.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题