移动端判断当前设备是ios还是andriod let u = navigator.userAgent if(u.indexOf('Android') > -1 || u.indexOf('Linux') > -1){ this.osType = 'Android'; } if(!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){ this.osType = 'ios'; } console.log("this.osType--------",this.osType)