纯血鸿蒙不支持plus了 plus.runtime.openURL用什么代替呢

爱因斯坦大表哥
- 发布:2024-07-14 13:46
- 更新:2025-04-02 17:22
- 阅读:750
5 个回复
爱因斯坦大表哥 (作者) - 123123
还有安装应用plus.runtime.install和plus.runtime.restart()重启应用
l***@163.com
请问解决了?
爱因斯坦大表哥 (作者)
没有
2024-07-16 11:34
码思泉涌 - y
可以考虑开发uts插件
DCloud_UNI_yuhe
鸿蒙 next 的 openUrl,使用 uts 插件,可以这样写,提供一个参考:
const openURL = (url : string, errorCB ?: (result : any) => void, identity ?: string) => {
let context = getContext() as common.UIAbilityContext;
复制代码
let link : string = url; let openLinkOptions : OpenLinkOptions = { appLinkingOnly: false, parameters: { demo_key: 'demo_value' } }; context.openLink(link, openLinkOptions, (result) => { if (errorCB) { errorCB(result); // 只有在 errorCB 存在时才调用 } }).then(() => { console.info(`open link success.`); }).catch((err : BusinessError) => { console.error(`open link failed, errCode ${JSON.stringify(err.code)}`); });
}
lihailan
plus.runtime.restart()重启应用 也是类似这样写?
2024-10-30 08:59
DCloud_UNI_yuhe
回复 lihailan: 对的,从鸿蒙文档里找一下对应的 api 即可
2024-10-30 10:48
t***@163.com
求解决代码