Administrator
发布于 2024-05-17 / 222 阅读
0
0

鸿蒙开发-打开外部浏览器带url2

Button("打开外部浏览器").onClick(()=>{
  const url = "https://h.app.coc.10086.cn/activity/transit/transferDownload.html?pageId=99992308030942022&channelId=P00000016911&targetURL=https%3A%2F%2Fwx.10086.cn%2Fqwhdhub%2Fqwhdmark%2F1021122301%3Ftouch_id%3DJTST_P00000016911%26yx%3DJHQD9999999999%26channelId%3DP00000016911%26pageResource%3Djdjr%26wbToken%3D123"
  let wantInfo: Want = {
    // uncomment line below if wish to implicitly query only in the specific bundle.
    // bundleName: 'com.example.myapplication',
    action: 'ohos.want.action.viewData',
    // entities can be omitted.
    entities: ['entity.system.browsable'],
    uri: url
  }
  let context = getContext(this) as common.UIAbilityContext
  context.startAbility(wantInfo);

}).margin({top:10})

点击按钮,打开外部浏览器,且浏览器跳转某个url


评论