【类 型】:factor 屏幕宽度小于480 即手机 点击导航栏 后自动缩回

【原  因】:方便操作不用再点一次  导航栏缩回按钮
【过  程】:还有如果是飞机操作界面 还会延时刷新 地图  防止地图缺失
【影  响】:
This commit is contained in:
tk 2024-07-25 14:28:31 +08:00
parent 00e42da59b
commit 45b10f9c37
3 changed files with 17 additions and 8 deletions

View File

@ -520,7 +520,6 @@ export default {
} }
// //
this.createPathWithArray(pathArr) // this.createPathWithArray(pathArr) //
console.log(pathArr)
// //
if (this.isflow) { if (this.isflow) {
this.map.flyTo({ this.map.flyTo({
@ -561,11 +560,8 @@ export default {
* @description:重置地图大小 * @description:重置地图大小
*/ */
handleResize () { handleResize () {
console.log('hi')
if (this.map) { if (this.map) {
setTimeout(() => { this.map.resize()
this.map.resize()
}, 300)
} }
} }
}, },

View File

@ -135,7 +135,9 @@ export default {
isCollapse: { isCollapse: {
handler (val) { handler (val) {
if (val) { if (val) {
this.$refs.mapbox.handleResize() setTimeout(() => {
this.$refs.mapbox.handleResize()
}, 500)
} }
} }
} }

View File

@ -17,7 +17,7 @@
background-color="#304156" text-color="rgb(191, 203, 217)" active-text-color="#409EFF" background-color="#304156" text-color="rgb(191, 203, 217)" active-text-color="#409EFF"
:collapse-transition="false" :collapse="isCollapse"> :collapse-transition="false" :collapse="isCollapse">
<template v-for="(route, index) in routes"> <template v-for="(route, index) in routes">
<el-menu-item v-if="route.children.length < 2" :key="route.path" :index="route.children[0].path"> <el-menu-item @click="lt480Collapse()" v-if="route.children.length < 2" :key="route.path" :index="route.children[0].path">
<i class="fc" :class="route.children[0].meta.icon"></i> <i class="fc" :class="route.children[0].meta.icon"></i>
<span slot="title">{{ route.children[0].meta.title }}</span> <span slot="title">{{ route.children[0].meta.title }}</span>
</el-menu-item> </el-menu-item>
@ -26,7 +26,7 @@
<i class="fc" :class="route.meta.icon"></i> <i class="fc" :class="route.meta.icon"></i>
<span>{{ route.meta.title }}</span> <span>{{ route.meta.title }}</span>
</template> </template>
<el-menu-item v-for="child in route.children" :key="child.path" :index="child.path"> <el-menu-item @click="lt480Collapse()" v-for="child in route.children" :key="child.path" :index="child.path">
<i class="fc" :class="child.meta.icon"></i> <i class="fc" :class="child.meta.icon"></i>
<span>{{ child.meta.title }}</span> <span>{{ child.meta.title }}</span>
</el-menu-item> </el-menu-item>
@ -99,6 +99,17 @@ export default {
} }
}, },
methods: { methods: {
/**
* @description: 屏幕宽度小于480 隐藏侧边栏
*/
lt480Collapse () {
// 480
if (window.innerWidth < 480) {
setTimeout(() => {
this.$store.commit('app/setCollapse')
}, 10)
}
},
/** /**
* @description: 动态加载路由 * @description: 动态加载路由
*/ */