解决方案:router不支持map类型的数据传参,params中只能包含基础类型的数据.可以使用Record代替mapprivate routerParams : RouterParams = new RouterParams() private param : Record<string, string> = {}; routePage() { try { this.param['vip_source'] = 'qww' this.routerParams.pageType = '11' this.routerParams.params = this.param this.routerParams.title = '新闻' router.pushUrl({ url: 'pages/RouterA', params: this.routerParams }) } catch (err) { console.info(` fail callback, code: ${err.code}, msg: ${err.msg}`) } } @State value:Record<string, Record<string,string>> = router.getParams() as Record<string, Record<string,string>>; onPageShow() { console.log("hh2:" + this.value['title']) console.log("hh3:" + this.value['params']['vip_source']) }
解决方案:router不支持map类型的数据传参,params中只能包含基础类型的数据.可以使用Record代替map