uni-app:showModal消息提示(确认、取消)

效果

代码

html 复制代码
<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>
相关推荐
万少18 小时前
HarmonyOS 开发必会 5 种 Builder 详解
前端·harmonyos
橙序员小站20 小时前
Agent Skill 是什么?一文讲透 Agent Skill 的设计与实现
前端·后端
炫饭第一名1 天前
速通Canvas指北🦮——基础入门篇
前端·javascript·程序员
王晓枫1 天前
flutter接入三方库运行报错:Error running pod install
前端·flutter
符方昊1 天前
React 19 对比 React 16 新特性解析
前端·react.js
ssshooter1 天前
又被 Safari 差异坑了:textContent 拿到的值居然没换行?
前端
曲折1 天前
Cesium-气象要素PNG色斑图叠加
前端·cesium
Forever7_1 天前
Electron 淘汰!新的桌面端框架 更强大、更轻量化
前端·vue.js
Angelial1 天前
Vue3 嵌套路由 KeepAlive:动态缓存与反向配置方案
前端·vue.js
jiayu1 天前
Angular学习笔记24:Angular 响应式表单 FormArray 与 FormGroup 相互嵌套
前端