App.vue 2.08 KB
<template>
	<div id="app">
		<router-view v-if="isRouterAlive" />
		<div class="loading" v-show="isShow">
			<div class="content">
				<i class="fa fa-spinner fa-pulse fa-3x fa-fw" style="color:#0081FF"></i>
				<span>{{tips}}</span>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	provide(){
		return{
			reload:this.reload
		}
	},
	data(){
		return{
			isRouterAlive:true,
			isShow:false,
			tips:'正在努力加载中...'
		}
	},
	mounted() {
		window.addEventListener("unload", this.saveState);
		window.vm = this;
	},
	methods: {
		saveState() {
			sessionStorage.setItem("state", JSON.stringify(this.$store.state));
		},
		reload(){
			this.isRouterAlive = false;
			this.$nextTick(function () {
				this.isRouterAlive = true;
			})
		},
		loadingShow(tips){
			this.isShow = true;
			this.tips = tips+'...';
		},
		loadingHide(tips){
			this.isShow = false;
		}
	},
};
</script>

<style lang="less">
#app{
	position: relative;
	
	.loading{
		width: 100%;
		height: 100%;
		// background-color: rgba(255, 255, 255, .3);
		position: absolute;
		top: 0;
		left: 0;
		z-index: 1;
		.content{
			width: 240px;
			height: 160px;
			background: #FFFFFF;
			box-shadow: 0px 4px 28px 0px rgba(0, 0, 0, 0.24);
			border-radius: 4px;
			border: 1px solid #E6E6E6;
			box-sizing: border-box;
			padding: 32px;
			position: absolute;
			top: 50%;
			left: 50%;
			margin-left: -80px;
			margin-top: -120px;
			i,span{
				display: block;
				margin: 0 auto;
				text-align: center;
			}
			span{
				margin-top: 26px;
				color: #6D7278;
				font-size: 14px;
			}
		}
	}
}
.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>