子组件弹框关不了怎么办

老铁们可以帮我看看问题出在哪了吗,点了关闭键之后弹框关不了又弹出来了

 父组件

<template>
	<div class="nav-bar">
		城市影院
		<span class="iconfont icon-gengduo icon-5" 
		@click="showDialog">
			<my-dialog
				:showDialog="isShowDialog"
				@closeDialog="isShowDialog=false" >
			</my-dialog>
		</span>
	</div>
</template>

<script>
	import MyDialog from "./mdialog.vue";
	export default{
			data(){
				return{
					isShowDialog: false
				}
			},
			components:{
			MyDialog:MyDialog
			},
			methods: {
			   showDialog: function(){
			   			this.isShowDialog = true;
			   		}
			  },
		}	
</script>

<style lang="scss" scoped>
	.nav-bar {
		background-color: var(--primaryColor);
		height: 45px;
		color: white;
		font-weight: bold;
		font-size: 18px;
		/* 弹性盒子 */
		display: flex;
		/* 主轴(水平)居中 */
		justify-content: center;
		/* 副轴(垂直)居中 */
		align-items: center;
		position: relative;
	}
	
	.nav-bar .icon-nav-right-menu{
		position: absolute;
		right: 10px;
		font-size: 22px;
		font-weight: lighter;
	}
	.icon-5{
		position: absolute;
		right: 10px;
		top: 15px;
	}
</style>

子组件

<template>
<transition name="dialog">
	<div 
		v-if="showDialog"
		id="dialog-bg"
		@touchmove.prevent 
		@scroll.prevent >
		<div id="dialog" >
			<button
				class="dialog-button">
				 登录账号</button>
				 <hr>
			<button 
				class="dialog-button"
				@click="close" >取消</button>
		</div>
	</div>
</transition>
</template>

<script>
	
	export default{
		props:{
			showDialog: Boolean,
			title: String,
			message: String
		},
		
		methods: {
			close: function(){
				this.$emit("closeDialog");
			}
		},
		
		watch:{
			
		}
		
	}
</script>

<style>
	* {
		box-sizing: border-box;
	}
	
	#dialog-bg{
		top: 0;
		left: 0;
		position: fixed;
		width: 100vw;
		height: 100vh;
		background-color: rgba(0,0,0,0.5);
		z-index: 98;
	}
	
	#dialog{
		border-radius: 20px 20px 0 0;
		position: fixed;
		bottom: 0;
		background-color: #FFFFFF;
		width: 100vw;
		padding: 10px;
		padding-bottom: 15px;
	}
	
	/* 适配电脑等大屏幕 */
	@media (min-width: 750px) {
		#dialog{
			width: 500px;
			left:0;
			right:0;
			margin:0 auto;
		}
	}
	
	.dialog-button{
		width: 100%;
		background-color: white;
		border-width: 0;
		padding: 10px;
		outline: none;
		color: black;
		font-size: 15px;
	}
	
	.dialog-button:focus {
		outline: none;
	}
	
	.dialog-button:active{
		background-color: #585dbe;
		border-color: #585dbe;
	}
	
	
	.dialog-enter-active, .dialog-leave-active {
	  transition: all .5s;
	}
	
	.dialog-enter, .dialog-leave-to {
	  opacity: 0;
	  transform: translateY(300px);
	}
	
	
</style>

页面

<template>
	<div class="full-page">
		<nav-bar></nav-bar>
		<div class="content-box">
			<div class="Cinema-box">
				<div class="">
					城市影院影厅一
				</div>
				<div class="">
					武汉华夏学院多功能报告厅一号厅
				</div>
			</div>
			<hr>
		</div>
		
		<tabBar></tabBar>
	</div>
</template>

<script>
	import NavBar from "../components/NavBar.vue";
	import TabBar from "../components/TabBar.vue";
	
	export default{
		data(){
			return{
				
			}
		},
		components:{
		NavBar:NavBar,
		TabBar:TabBar,
		
		},
		methods: {
		  
		  },
	}
	
	
</script>

<style>
	.full-page{
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
	}
	.content-box {
		/* 占满弹性盒子剩下的空间 */
		flex: 1;
		/* 溢出处理 */
		overflow: auto;
	}

</style>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>