Commit 7725f72b authored by Pan's avatar Pan

perf[ResizeHandler]: optimized the judgment of isMobile

parent a0b46fed
import store from '@/store' import store from '@/store'
const { body } = document const { body } = document
const WIDTH = 1024 const WIDTH = 992 // refer to Bootstrap's responsive design
const RATIO = 3
export default { export default {
watch: { watch: {
...@@ -25,7 +24,7 @@ export default { ...@@ -25,7 +24,7 @@ export default {
methods: { methods: {
isMobile() { isMobile() {
const rect = body.getBoundingClientRect() const rect = body.getBoundingClientRect()
return rect.width - RATIO < WIDTH return rect.width - 1 < WIDTH
}, },
resizeHandler() { resizeHandler() {
if (!document.hidden) { if (!document.hidden) {
......
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