我这边对象生成了默认的get、set方法,然后该对象通过router的传参方式传到下一个页面,转换后的对象通过get方法无法获取到对应的属性值,代码片段如下
private _appID = "";
public set AppID(value) {
this._appID = value;
}
public get AppID() {
return this._appID;
}
router.pushUrl({ url: 'pages/WebPage', params : item })
this.moduleItem = router.getParams() as MoudleItemDbBean
this.moduleItem.AppID 这里获取出来为null
paramas不支持传递方法和系统返回的对象,可参考以下传值方式:
或者
具体可查看文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-router-V5\#routeroptions