跳转
关闭当前窗口
可选
需要返回给父窗口的数据
ymx.close() .then(() => { console.log('成功'); }) .catch((e) => { alert(`失败 ${JSON.stringify(e)}`); }); 复制
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)}`);}); 复制
// 带返回值的关闭,在 ymx.open() 的 onResult 函数中接收处理返回值ymx.close({ hello: 'world 世界', year: 2026}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);});
拉起第三方应用
成功的 urls 序号
ymx.launch({ url: 'https://xw.qq.com/'}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);}); 复制
ymx.launch({ url: 'https://xw.qq.com/'}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);});
ymx.launch({ url: 'weixin://'}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);}); 复制
ymx.launch({ url: 'weixin://'}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);});
ymx.launch({ url: 'tel://1801234'}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);}); 复制
ymx.launch({ url: 'tel://1801234'}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);});
在新窗口中打开链接
ymx.open({ url: 'https://xw.qq.com/'}).then(() => { console.log('成功');}).catch((e) => { alert(`失败 ${JSON.stringify(e)}`);}); 复制
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)}`);}); 复制
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)}`);});
跳转