uni-app: showModal メッセージ プロンプト (確認、キャンセル)

効果

コード

<template>
	<view>
		<button @longpress="handleLongPress">点我出现删除消息</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		methods: {
			handleLongPress(e) {
				//删除设备
				uni.showModal({
					title: '提示',
					content: '是否删除',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定')
						} else if (res.cancel) {
							console.log('用户点击取消')
						}
					}
				})
			}
		}
	};
</script>
<style>
	.item_all {
		margin-bottom: 3%;
	}

	.position {
		padding: 6% 0;
		width: 100%;
		background-color: #fff;
		box-shadow: 4rpx 4rpx 4rpx gainsboro;
	}

	.vv_1 {
		margin: 0 5%;
		word-break: break-all;
	}
</style>

おすすめ

転載: blog.csdn.net/weixin_46001736/article/details/133358736