uniapp判断当前环境是安卓还是苹果

技术 · 01-30

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
);
vue3 uniapp
Theme Jasmine by Kent Liao