BigInt类型参数用来页面传参,会导致页面无法打开,并且不报错

BigInt类型参数用来页面传参,会导致页面无法打开,并且不报错。

HarmonyOS
2024-10-11 10:41:20
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

params参数不能传递方法和系统接口返回的对象(例如,媒体接口定义和返回的PixelMap对象)。建议开发者提取系统接口返回的对象中需要被传递的基础类型属性,自行构造object类型对象进行传递。参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-router-V5

import router from '@ohos.router'  
  
@Entry  
@Component  
struct Test {  
  
  build() {  
    Column() {  
      Text("测试").onClick(()=>{  
        try {  
          router.pushUrl({  
            url: "pages/Index",  
            params: {  
              color: BigInt(0)  
            }  
          }).catch(() => {  
            console.log(`exception: 0`)  
          })  
        } catch (e) {  
          console.log(`exception: ${e.message}`)  
        }  
      })  
    }  
    .backgroundColor($r('app.color.bg_color'))  
    .width('100%')  
    .height('100%')  
  
  }  
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
分享
微博
QQ
微信
回复
2024-10-11 16:35:03
相关问题
HarmonyOS 页面问题
1233浏览 • 1回复 待解决
HarmonyOS 页面间如何
1739浏览 • 1回复 待解决
HarmonyOS 调用flutter页面
628浏览 • 1回复 待解决
HarmonyOS 页面后对象出错
567浏览 • 1回复 待解决
HarmonyOS webview加载页面无法显示
1768浏览 • 1回复 待解决
HarmonyOS 参数问题
884浏览 • 1回复 待解决
HarmonyOS 列表多选页面无法刷新
693浏览 • 1回复 待解决
HarmonyOS hap跳hsp页面无法跳转
951浏览 • 1回复 待解决
HarmonyOS 分屏模式下页面无法滑动
660浏览 • 1回复 待解决
HarmonyOS scroll嵌套list页面无法滑动
1392浏览 • 1回复 待解决
HarmonyOS Web组件加载本地页面问题
1239浏览 • 1回复 待解决
如何在navigation跳转页面时返回
2709浏览 • 1回复 待解决
HarmonyOS 页面导航跳转回调问题
2292浏览 • 0回复 待解决
HarmonyOS Har静态包内部页面无法跳转
1451浏览 • 1回复 待解决