Commit e054cc48 authored by 毛线's avatar 毛线

移动端兼容

parent 03df51db
......@@ -10,6 +10,7 @@
<script>
import { mapActions, mapMutations } from 'vuex'
import { deviceType } from '@/utils/device-type'
import Audio from '@/components/common/audio/index'
export default {
components: {
......@@ -59,14 +60,16 @@ export default {
]),
initSceen() {
const { innerWidth, } = window
const isMobile = deviceType(navigator.userAgent)
if (process.env.NODE_ENV === 'development') {
// return
}
if (innerWidth > 750) {
if (innerWidth < 750 || isMobile) {
this.initMobileSceen()
this.isMoblie = true
} else {
this.initPcSceen()
this.isMoblie = false
} else {
this.initMobileSceen()
}
},
// 初始化pc屏幕
......
/**
*
* @param {*} UA ,就是userAgent
* @returns type: 设备类型
* env: 访问环境(微信/微博/qq)
*/
function isMoible(UA) {
return !!/(Android|webOS|iPhone|iPod|tablet|BlackBerry|Mobile)/i.test(UA)
}
export function deviceType(UA) {
if (isMoible(UA)) {
return true
} else {
return false
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment