Skip to content

Commit c0f378e

Browse files
committed
perf[ResizeHandler]: optimized the judgment of isMobile (PanJiaChen#1633)
perf[ResizeHandler]: optimized the judgment of isMobile
1 parent 6b88c41 commit c0f378e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/views/layout/mixin/ResizeHandler.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import store from '@/store'
22

33
const { body } = document
4-
const WIDTH = 1024
5-
const RATIO = 3
4+
const WIDTH = 992 // refer to Bootstrap's responsive design
65

76
export default {
87
watch: {
@@ -25,7 +24,7 @@ export default {
2524
methods: {
2625
isMobile() {
2726
const rect = body.getBoundingClientRect()
28-
return rect.width - RATIO < WIDTH
27+
return rect.width - 1 < WIDTH
2928
},
3029
resizeHandler() {
3130
if (!document.hidden) {

0 commit comments

Comments
 (0)