From 0f3d2bcd051dc3e91b14c7e764ae80d7b5dcb772 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= <panfree23@gmail.com>
Date: Mon, 25 Feb 2019 17:54:10 +0800
Subject: [PATCH] perf[ResizeHandler]: optimized the judgment of isMobile
 (#1633)

perf[ResizeHandler]: optimized the judgment of isMobile
---
 src/views/layout/mixin/ResizeHandler.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/views/layout/mixin/ResizeHandler.js b/src/views/layout/mixin/ResizeHandler.js
index 2636d5bd..352ab133 100644
--- a/src/views/layout/mixin/ResizeHandler.js
+++ b/src/views/layout/mixin/ResizeHandler.js
@@ -1,8 +1,7 @@
 import store from '@/store'
 
 const { body } = document
-const WIDTH = 1024
-const RATIO = 3
+const WIDTH = 992 // refer to Bootstrap's responsive design
 
 export default {
   watch: {
@@ -25,7 +24,7 @@ export default {
   methods: {
     isMobile() {
       const rect = body.getBoundingClientRect()
-      return rect.width - RATIO < WIDTH
+      return rect.width - 1 < WIDTH
     },
     resizeHandler() {
       if (!document.hidden) {