Преглед на файлове

perf[ResizeHandler]: optimized the judgment of isMobile

Pan преди 6 години
родител
ревизия
7725f72beb
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. 2 3
      src/views/layout/mixin/ResizeHandler.js

+ 2 - 3
src/views/layout/mixin/ResizeHandler.js

@@ -1,8 +1,7 @@
1 1
 import store from '@/store'
2 2
 
3 3
 const { body } = document
4
-const WIDTH = 1024
5
-const RATIO = 3
4
+const WIDTH = 992 // refer to Bootstrap's responsive design
6 5
 
7 6
 export default {
8 7
   watch: {
@@ -25,7 +24,7 @@ export default {
25 24
   methods: {
26 25
     isMobile() {
27 26
       const rect = body.getBoundingClientRect()
28
-      return rect.width - RATIO < WIDTH
27
+      return rect.width - 1 < WIDTH
29 28
     },
30 29
     resizeHandler() {
31 30
       if (!document.hidden) {