12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <template>
- <div class='home'>
- <menu-list v-if='showMenu' :modelNum.sync='modelNum' @handlerouterName='handlerouterName'></menu-list>
- <router-view />
- </div>
- </template>
- <script>
- import menuList from '@/components/menuList.vue'
- export default {
- props: [],
- data() {
- return {
- modelNum: 0,
- // shebeisheshiShow: false,
- routerName: 'aa',
- imgSrcNum: 1,
- tanchuanShow: false,
- showMenu: true //是否显隐menuList
- }
- },
- computed: {},
- created() {},
- mounted() {
- // 路由为home下的legendLibrary(图例)时,刷新时执行 handleRoute 路由处理函数
- this.handleRoute(this.$route)
- },
- watch: {
- // tanchuanShow(newVal) {
- // console.log(newVal)
- // }
- $route: 'handleRoute'
- },
- methods: {
- handlerouterName(val) {
- this.routerName = val
- if (val == 'de') {
- this.modelNum = 3
- } else if (val == 'floorFunc') {
- this.modelNum = 2
- }
- },
- /**
- * @name handleRoute
- * @param newRoute 当前路由
- * @description 路由处理函数, 当前路由为home下的legendLibrary和legendRules(图例)时,隐藏 menuList组件
- */
- handleRoute(newRoute) {
- let path = ''
- let ignoreRoute = ['legendRules', 'legendLibrary']
- newRoute.path && (path = newRoute.path)
- if (!path) {
- return true
- }
- let lastPath = path.split('home/')[1]
- if (ignoreRoute.includes(lastPath)) {
- this.showMenu = false
- } else {
- this.showMenu = true
- }
- }
- },
- components: {
- menuList
- }
- }
- </script>
- <style lang="less">
- .home {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- canvas:focus {
- outline: none;
- }
- }
- </style>
|