vue跳转指定页面

根据图标打开新的页面,跳转到指定页面,之后在此页面隐藏该跳转图标

route:

{
   path: '/mainScreen',
   component: () =>
     import( /* webpackChunkName: "page" */ '@/views/wel/mainScreen'),
   name: '500',
   meta: {
     keepAlive: true,
     isTab: false,
     isAuth: false
   }
},

template:

<img  v-if="!isShowfullScreen" 
	  class="head-img" 
	  @click="screenInfo" 
	  src="../../../public/img/bg/screen-icon.png" 
	  alt="" 
	  srcset="" />

script:

data(){
	return{
		isShowfullScreen:true
    }
},
mounted() {
	 this.isShowfullScreen = this.$route.query.isShowfullScreen
},
methods:{
	screenInfo() {
		const mainScreen = this.$router.resolve('/mainScreen?isShowfullScreen=false')
        window.open(mainScreen.href,'_blank')
	},
}

说明: 这样的跳转存在一个不安全的问题,就是会显式的在报文上面追加了该判断的变量,即路由后面加上了/mainScreen?isShowfullScreen=false,若手动删除该变量,图标又会展示出来了

Logo

前往低代码交流专区

更多推荐