Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eslotsys-game-nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
毛线
eslotsys-game-nuxt
Commits
e054cc48
Commit
e054cc48
authored
Jul 12, 2023
by
毛线
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移动端兼容
parent
03df51db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
default.vue
layouts/default.vue
+6
-3
device-type.js
utils/device-type.js
+18
-0
No files found.
layouts/default.vue
View file @
e054cc48
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<
script
>
<
script
>
import
{
mapActions
,
mapMutations
}
from
'vuex'
import
{
mapActions
,
mapMutations
}
from
'vuex'
import
{
deviceType
}
from
'@/utils/device-type'
import
Audio
from
'@/components/common/audio/index'
import
Audio
from
'@/components/common/audio/index'
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -59,14 +60,16 @@ export default {
...
@@ -59,14 +60,16 @@ export default {
]),
]),
initSceen
()
{
initSceen
()
{
const
{
innerWidth
,
}
=
window
const
{
innerWidth
,
}
=
window
const
isMobile
=
deviceType
(
navigator
.
userAgent
)
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
// return
// return
}
}
if
(
innerWidth
>
750
)
{
if
(
innerWidth
<
750
||
isMobile
)
{
this
.
initMobileSceen
()
this
.
isMoblie
=
true
}
else
{
this
.
initPcSceen
()
this
.
initPcSceen
()
this
.
isMoblie
=
false
this
.
isMoblie
=
false
}
else
{
this
.
initMobileSceen
()
}
}
},
},
// 初始化pc屏幕
// 初始化pc屏幕
...
...
utils/device-type.js
0 → 100644
View file @
e054cc48
/**
*
* @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
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment