<template name="dever-drawer-window">
	<view :style="{background:background,zIndex:zIndex, top:top+'px'}">
		<view :class="['DrawerClose_' + direction, show ? 'show' : '']" @tap="hideModal">
			<text :class="'cuIcon-pull'+direction"></text>
		</view>
		<scroll-view scroll-y :class="['DrawerWindow_' + direction, show ? 'show' : '']" :style="{width:width,padding:padding, zIndex:zIndex+1, background:slotBg}" @tap.stop="stopFun" @touchstart="start" @touchend="end" @scrolltolower="bottomCall">
			<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 {
	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 : 10
		},
		// #ifdef H5
		top:{
			type : Number,
			default : 44
		},
		// #endif
		// #ifndef H5
		top:{
			type : Number,
			default : 0
		},
		// #endif
		type : {
			type : String,
			default : ''
		},
	},
	data() {
		return {
			
		};
	},
	mounted() {
		
	},
	methods:{
		bottomCall : function() {
			this.$emit('bottomFunc');
		},
		closeDrawer : function(){
			this.$emit('closeDrawer');
		},
		start : function(e) {
			return this.Dever.slide(e);
		},
		end : function(e) {
			if (this.type == 'share') {
				return;
			}
			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_left {
	position: absolute;
	width: 85vw;
	height: 100vh;
	left: 0;
	top: 0;
	transform: scale(1, 1) translateX(-100%);
	opacity: 1;
	pointer-events: none;
	transition: all 0.4s;
}

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

.DrawerWindow_down {
	position: absolute;
	width: 85vw;
	height: 100vh;
	left: 0;
	top: 0;
	transform: scale(1, 1) translateY(100%);
	opacity: 1;
	pointer-events: none;
	transition: all 0.4s;
}

.DrawerWindow_down.show {
	height: 91vh;
	transform: scale(1, 1) translateY(10%);
	opacity: 1;
	pointer-events: all;
}

.DrawerClose_left {
	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_left.show {
	opacity: 1;
	pointer-events: all;
	width: 15vw;
	color: #fff;
}

.DrawerClose_down {
	position: absolute;
	width: 176vw;
	height: 30vh;
	left: 0;
	top: 0;
	color: transparent;
	padding-bottom: 30upx;
	padding-left: 60upx;
	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_down.show {
	opacity: 1;
	pointer-events: all;
	height: 10vh;
	color: #fff;
}

.card-menu {
	border-radius: 0px;
}
</style>
