core
    正在准备搜索索引...

    接口 YmxJump

    跳转

    interface YmxJump {
        canHandle(data: LaunchData): Promise<boolean>;
        close(result?: any): Promise<void>;
        launch(data: LaunchData): Promise<void>;
        open(data: OpenData): Promise<void>;
    }

    层级 (查看层级一览)

    索引

    方法

    • 是否可以处理指定的 uri,主要用于检测是否已安装对应的 App。

      • 仅能检测在 query schemes 中已注册的 url scheme,未注册返回 false。
      • launch 接口不同,如 launch weixin:// 不要求注册 weixin scheme,只要安装了微信客户端即可拉起。

      参数

      返回 Promise<boolean>

      true 可以处理 url, false 不可以

    • 关闭当前窗口

      参数

      • 可选result: any

        需要返回给父窗口的数据

      返回 Promise<void>

      ymx.close()
      .then(() => {
      console.log('成功');
      })
      .catch((e) => {
      alert(`失败 ${JSON.stringify(e)}`);
      });
      // 带返回值的关闭,在 ymx.open() 的 onResult 函数中接收处理返回值
      ymx.close({
      hello: 'world 世界',
      year: 2026
      }).then(() => {
      console.log('成功');
      }).catch((e) => {
      alert(`失败 ${JSON.stringify(e)}`);
      });
    • 拉起第三方应用,不要求在 query schemes 中注册 url scheme,只要安装了对应应用即可拉起。

      参数

      返回 Promise<void>

      ymx.launch({
      uri: 'https://xw.qq.com/'
      }).then(() => {
      console.log('成功');
      }).catch((e) => {
      alert(`失败 ${JSON.stringify(e)}`);
      });
      ymx.launch({
      uri: 'weixin://'
      }).then(() => {
      console.log('成功');
      }).catch((e) => {
      alert(`失败 ${JSON.stringify(e)}`);
      });
      ymx.launch({
      uri: 'tel://1801234'
      }).then(() => {
      console.log('成功');
      }).catch((e) => {
      alert(`失败 ${JSON.stringify(e)}`);
      });
    • 在新窗口中打开链接

      参数

      返回 Promise<void>

      ymx.open({
      url: 'https://xw.qq.com/'
      }).then(() => {
      console.log('成功');
      }).catch((e) => {
      alert(`失败 ${JSON.stringify(e)}`);
      });
      ymx.open({
      url: 'https://xw.qq.com/',
      style: 'dialog',
      onResult: (result) => {
      // 关闭子窗口时返回的结果 ymx.close(result)
      console.log(result);
      }
      }).then(() => {
      console.log('成功');
      }).catch((e) => {
      alert(`失败 ${JSON.stringify(e)}`);
      });