<template name="drawerWindow">
	<view :style="{background:background,zIndex:zIndex, top:top+'px'}">
		<view class="DrawerClose" :class="show ? 'show':''" @tap="hideModal">
			<text class="cuIcon-pullright"></text>
		</view>
		<scroll-view scroll-y class="DrawerWindow" :class="show ? 'show':''" :style="{width:width,padding:padding, zIndex:zIndex+1, background:slotBg}" @tap.stop="stopFun" @touchstart="Dever.slide" @touchend="end">
			<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg" v-if="show">
				<slot name="links"></slot>
			</view>
		</scroll-view>
	</view>
</template>

<script>
export default {
	name: "drawerWindow",
	props: {
		show : {
			type : Boolean,
			default : false
		},
		direction : {
			type : String,
			default : 'left'
		},
		width : {
			type : String,
			default : '60%'
		},
		background:{
			type : String,
			default : 'rgba(0, 0, 0, 0.5)'
		},
		slotBg:{
			type : String,
			default : 'rgba(255, 255, 255, 1)'
		},
		padding :{
			type : String,
			default : '30rpx'
		},
		zIndex : {
			type : Number,
			default : 1
		},
		// #ifdef H5
		top:{
			type : Number,
			default : 44
		},
		// #endif
		// #ifndef H5
		top:{
			type : Number,
			default : 0
		},
		// #endif
	},
	data() {
		return {
			
		};
	},
	methods:{
		closeDrawer : function(){
			this.$emit('closeDrawer');
		},
		end : function(e) {
			var type = this.Dever.slideEnd(e);
			if (type == 3 || type == 4) {
				this.closeDrawer();
			}
		},
		showModal : function(e) {
			this.show = true;
		},
		hideModal : function(e) {
			this.closeDrawer();
		},
		stopFun : function() {
			
		}
	}
}
</script>

<style>
.DrawerWindow {
	position: absolute;
	width: 85vw;
	height: 100vh;
	left: 0;
	top: 0;
	transform: scale(0.9, 0.9) translateX(-100%);
	opacity: 0;
	pointer-events: none;
	transition: all 0.4s;
}

.DrawerWindow.show {
	transform: scale(1, 1) translateX(0%);
	opacity: 1;
	pointer-events: all;
}

.DrawerClose {
	position: absolute;
	width: 40vw;
	height: 100vh;
	right: 0;
	top: 0;
	color: transparent;
	padding-bottom: 30upx;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));
	letter-spacing: 5px;
	font-size: 50upx;
	opacity: 0;
	pointer-events: none;
	transition: all 0.4s;
}

.DrawerClose.show {
	opacity: 1;
	pointer-events: all;
	width: 15vw;
	color: #fff;
}
</style>
