第一步:下载
npm install current-device
第二步:引入:在使用的组建中引入:
import device from 'current-device'
第三步:使用:
mounted(){
if (device.mobile()) {
console.log('移动手机')
} else if (device.ipad()) {
console.log('ipad')
} else if (device.desktop()) {
console.log('电脑')
}
}