JS
使用微信提供的API wx.getSystemInfoSync();
let res = wx.getSystemInfoSync();
if(res.platform == 'ios') //ios
if(res.platform == 'android') //安卓
if(res.platform == 'devtools') //開發者工具
let res = wx.getSystemInfoSync();
if(res.platform == 'ios') //ios
if(res.platform == 'android') //安卓
if(res.platform == 'devtools') //開發者工具
微信小程序真機調試時出現了,Error: request:fail url not in domain list:api.xxx.com 需要把網址添加到合法域名中,見圖 --- 自用 不解釋