|
@@ -1,7 +1,7 @@
|
|
import store from '@/store'
|
|
import store from '@/store'
|
|
-import { mapGetters, mapState } from "vuex";
|
|
|
|
|
|
+
|
|
const { body } = document
|
|
const { body } = document
|
|
-const WIDTH = 992 // refer to Bootstrap's responsive design
|
|
|
|
|
|
+const WIDTH = 200 // refer to Bootstrap's responsive design
|
|
|
|
|
|
export default {
|
|
export default {
|
|
watch: {
|
|
watch: {
|
|
@@ -11,9 +11,6 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- computed: {
|
|
|
|
- ...mapGetters(["sidebarRouters", "sidebar"]),
|
|
|
|
- },
|
|
|
|
beforeMount() {
|
|
beforeMount() {
|
|
window.addEventListener('resize', this.$_resizeHandler)
|
|
window.addEventListener('resize', this.$_resizeHandler)
|
|
},
|
|
},
|
|
@@ -36,13 +33,14 @@ export default {
|
|
},
|
|
},
|
|
$_resizeHandler() {
|
|
$_resizeHandler() {
|
|
if (!document.hidden) {
|
|
if (!document.hidden) {
|
|
|
|
+ const reatWith = body.getBoundingClientRect().width
|
|
|
|
|
|
const isMobile = this.$_isMobile()
|
|
const isMobile = this.$_isMobile()
|
|
store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop')
|
|
store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop')
|
|
-
|
|
|
|
- if (isMobile) {
|
|
|
|
|
|
+ if (reatWith < 900) {
|
|
store.dispatch('app/closeSideBar', { withoutAnimation: true })
|
|
store.dispatch('app/closeSideBar', { withoutAnimation: true })
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
store.dispatch('app/openSideBar', { withoutAnimation: true })
|
|
store.dispatch('app/openSideBar', { withoutAnimation: true })
|
|
}
|
|
}
|
|
}
|
|
}
|