参考uni-app官方说明:https://uniapp.dcloud.io/api/router?id=navigateto
Vue.prototype.$ownExecuteAppOrH5Func = function (appFunc = null, h5Func = null) {
/**
* 功能:封装一个通用执行app或H5的方法
*/
let result = null;
// #ifdef APP-PLUS
result = appFunc && appFunc();
// #endif
// #ifdef H5
result = h5Func && h5Func();
// #endif
return result;
};
let url = "https://baidu.com";
Vue.prototype.$ownExecuteAppOrH5Func(() => {
this.$plusOpenWeb(url );
}, () => {
window.open(url );
});