App.vue 1.06 KB
<template>
	<div id="app">
		<router-view v-if="isRouterAlive" />
	</div>
</template>

<script>
export default {
	provide(){
		return{
			reload:this.reload
		}
	},
	data(){
		return{
			isRouterAlive:true,
		}
	},
	mounted() {
		window.addEventListener("unload", this.saveState);
	},
	methods: {
		saveState() {
			sessionStorage.setItem("state", JSON.stringify(this.$store.state));
		},
		reload(){
			this.isRouterAlive = false;
			this.$nextTick(function () {
				this.isRouterAlive = true;
			})
		},
	},
};
</script>

<style lang="less">
.popper-zxx{
	padding: 0!important;
	/deep/ .el-tabs__header{
		margin-bottom: 10px;
	}
	ul{
		margin-bottom: 10px;
		li{
			cursor: pointer;
			padding: 8px 16px;
			position: relative;
			i{
				position: absolute;
				right: 20px;
				top: 11px;
				color: #4EB2FF;
				display: none;
			}
		}
		li:hover{
			background: #F0F9FF;
		}
		.cantClick{
			color: #BBB!important;
			cursor: not-allowed!important;
		}
		.cantClick:hover{
			background: #ffffff!important;
		}
		.choosed{
			i{
				display: inline-block;
			}
		}
	}
}
</style>