在route/index.js,判断设备跳转到对应页面
const device = navigator.userAgent
if (device.indexOf('iPad') > -1) {
// ipad
} else if (device.indexOf('Android') > -1 || device.indexOf('ios') > -1) {
// 手机
} else {
// 电脑
}
在route/index.js中,通过navigator.userAgent判断设备类型。如果检测到iPad,执行针对iPad的逻辑;若检测到Android或iOS设备,则视为手机处理;其余情况默认为电脑处理。
在route/index.js,判断设备跳转到对应页面
const device = navigator.userAgent
if (device.indexOf('iPad') > -1) {
// ipad
} else if (device.indexOf('Android') > -1 || device.indexOf('ios') > -1) {
// 手机
} else {
// 电脑
}
499
445
2383

被折叠的 条评论
为什么被折叠?