HarmonyOS 对象作为参数传递时方法丢失

getValuesBucket() {  
  const valueBucket: relationalStore.ValuesBucket = {  
    c_gateway_id: this.gateWayId,  
    c_ip: this.gateWayIp,  
    c_port: this.gateWayPort,  
    c_ip_type_parent_id: this.cdmaTypeId,  
    c_ip_type_sub_id: this.ipTypeId  
  };  
  //属性存在则不自增,不存在自增  
  if (this.pkId) {  
    valueBucket.c_ip_id = this.pkId  
  }  
  return valueBucket;  
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.

router路由时,GateWayIp这个对象作为参数传递到另外一个界面时,传递之前,这个方法还能用呢,另外一个页面接收之后,这个对象里的这个方法就调用不了了,不知道为什么?是序列化的问题吗?

HarmonyOS
2024-09-26 11:04:48
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

router传递的参数会经过序列化,过程中会丢失方法。

分享
微博
QQ
微信
回复
2024-09-26 15:57:03


相关问题
HarmonyOS 怎么把组件作为参数传递
988浏览 • 1回复 待解决
HarmonyOS builder 作为 builder 的参数传递
862浏览 • 1回复 待解决
HarmonyOS 倒计时方法
1016浏览 • 1回复 待解决
HarmonyOS rest参数如何传递
892浏览 • 1回复 待解决
HarmonyOS @Prop参数传递问题
734浏览 • 1回复 待解决