uniapp---弹出框(弹窗)组件(有取消,确定按钮)代码

uniapp—弹出框组件(弹窗)组件(有取消,确定按钮)代码

popUptips.vue

<template>
	<view class="">
		<!-- 弹出框 -->
		<view class="masks" @click="colseBtn" v-if="isSHow"></view>
		<view class="kuangs paddingA40 marR40 marL40 boxSize " v-if="isSHow">
			<image class="iconSize30 floatR" src="/static/images/close1.png" mode="" @click="colseBtn"></image>
			<view class="FontCenter fontSize16 fontWei marB60 marT60 widP100">
				<view class="marB40">
					{{zdTit}}
				</view>
				{{zdTxt}}
			</view>
			<view class="display widP100 marT80">
				<view class="kuangbtn" @click="colseBtn">
					取消
				</view>
				<view class="kuangbtn kuangbtn1" @click="zdBtn">
					确定
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				inputVal: '',
				searTxt: '搜索',
			}
		},
		props: {
			// 组件输入值
			zdTit: {
				type: [String],
				default: '提示文字'
			},
			zdTxt: {
				type: [String],
				default: '提示内容'
			},
			isSHow:{
				type: [Boolean],
				default: false
			}
			
	
		},
		methods: {
			//点击取消按钮
			colseBtn() {
				this.$emit("colseBtn" )
			},
			
			//点击确定按钮
			zdBtn() {
				this.$emit("zdBtn")
			}
		},
		computed: {
			// 子组件中更改绑定的prop值最好使用计算属性computed解决
		},
		watch: {
			// father(){
			//   this.son = "儿子"
			// }
		},
	}
</script>

<style>
.masks {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		background-color: #2F2F2F;
		opacity: 0.8;
		z-index: 99;
	}

	.kuangs {
		width: 90%;
		border-radius: 20rpx;
		background-color: rgba(255, 255, 255, 100);
		position: fixed;
		top: 30%;
		z-index: 999;
	}

	.kuangbtn {
		width: 316rpx;
		height: 92rpx;
		line-height: 92rpx;
		border-radius: 60rpx 0px 0px 60rpx;
		background-color: rgba(246, 247, 251, 100);
		color: rgba(47, 47, 47, 100);
		font-size: 14px;
		text-align: center;
		border: 1px solid rgba(47, 47, 47, 100);
	}

	.kuangbtn1 {
		border-radius: 0px 60rpx 60rpx 0px;
		background-color: rgba(47, 47, 47, 100);
		color: #fff;
	}
	.paddingA40 {
		padding: 40rpx;
	}
	.marR40 {
		margin-bottom: 40rpx;
	}
	.marL40 {
		margin-left: 40rpx;
	}
	.boxSize {
		box-sizing: border-box;
	}
	.marB40 {
		margin-bottom: 40rpx;
	}
	.FontCenter {
		text-align: center;
	}
	
	.fontSize16 {
		font-size: 32rpx;
	}
	.fontBold {
		font-weight: bold;
	}
	.marB60 {
		margin-bottom: 60rpx;
	}
	.marT60 {
		margin-top: 60rpx;
	}
	.widP100 {
		width: 100%;
	}
	.marT80 {
		margin-top: 80rpx;
	}
	.iconSize30 {
		width: 62rpx;
		height: 62rpx;
	}
	.floatR {
		float: right;
	}
	.display {
		display: flex;
	}
	.fontWei {
		font-weight: bold;
	}
</style>

调用组件

<!-- 弹出框 -->
<popUptips zdTit='确认取消' :zdTxt='zdTxt' :isSHow='isSHow' @colseBtn='colseBtn' @zdBtn="zdBtn"></popUptips>


<script>
	export default {
		data() {
			return {
				zdTxt: '',
				isSHow: false,
			},
		},
		methods:{
			// 关闭弹出框
			colseBtn() {
				this.isSHow = false;
			},
			// 点击确定按钮
			zdBtn() {
				this.$myRequest('cancelPtClassOrder', 'POST', {
						uid: this.uid,
						gid: this.gid,
						oid: this.oid,
						ptid: this.ptid,
					})
					.then(v => {
						this.$alert(v.data);
						this.ptGetMemberPt();
						this.colseBtn();
					})
			},

		}
	}
</script>
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值