diff --git a/src/App.vue b/src/App.vue index bb6e4a7..83f5991 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,8 +19,8 @@ export default { window.addEventListener('beforeunload', () => { util.local.set(Setting.storeKey, this.$store.state); }); - - function IsPC() { + // 判断当前处于什么终端 true为PC端,false为手机端 + function IsPCModel() { var userAgentInfo = navigator.userAgent; var Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']; var flagPc = true; @@ -32,8 +32,15 @@ export default { } return flagPc; } - var flagZt = IsPC(); + var flagZt = IsPCModel(); this.$store.commit('updateModelType', flagZt) + window.onresize = () => { + if(document.body.clientWidth <= 1200) { + this.$store.commit('updateModelType', false) + }else { + this.$store.commit('updateModelType', true) + } + } } }; diff --git a/src/components/menuTree/index.vue b/src/components/menuTree/index.vue index 0ebde1c..650880d 100644 --- a/src/components/menuTree/index.vue +++ b/src/components/menuTree/index.vue @@ -32,4 +32,18 @@ export default { diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index 992663c..36ca414 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -3,16 +3,36 @@ - -
- - -
- - - + + + +