uniapp判断当前环境是安卓还是苹果:const UA = navigator.userAgent; app.provide('isIOS', !!UA.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)); app.provide( 'isAndroid', UA.indexOf('Android') > -1 || UA.indexOf('Linux') > -1 );
与苹果ios交互动作方法名称 shareFriendsPoster ,还有参数传给ios,如果没有参数需要传nullconst sharePosterConfigIOS = { posterImgUrl: unref(poster), drawId: id, activeCode: 'customer_coupon' } window.webkit.messageHandlers.shareFriendsPoster.postMessage(JSON.stringify(sharePosterConfigIOS))与安卓交互window.supportJs.shareFriendsPoster(unref(poster), unref(id),sharePosterConfig.activeCode)
铅笔Naruto
前端攻城狮