微信小程序:删除时提示是否删除
2024-10-10 20:13:38
代码如下:
wx.showModal({
title: '提示',
content: '确定要删除吗?',
success: function (sm) {
if (sm.confirm) {
// 用户点击了确定 可以调用删除方法了
} else if (sm.cancel) {
console.log('用户点击取消')
}
}
})
项目中使用:
deleteById(e) {
console.log(e);
this.QueryParam.baseId = e.currentTarget.dataset.id
var that = this;
wx.showModal({
title: '提示',
content: '确定要删除吗?',
success: function (sm) {
if (sm.confirm) {
// 用户点击了确定 可以调用删除方法了
request.postParam("/api/baseInfo/deleteBaseInfo",that.QueryParam,function(res){
console.log(res)
if(res.data.success){
wx.showToast({
title: "删除成功",
icon: 'none',
duration: 2000
})
that.getList(true);
}else{
wx.showToast({
title: "删除失败",
icon: 'none',
duration: 2000
})
}
});
} else if (sm.cancel) {
console.log('用户点击取消')
}
}
})
},
注意:var that = this;放在外面
最新文章
- c++堆
- 一道常被人轻视的前端JS面试题
- 介绍Oedis - Redis OH/RM
- 【转】CentOS环境下yum安装LAMP(Linux+Apache+Mysql+php)
- 最新版EJS的include函数已支持参数传递
- Linux_08------Linux的系统管理
- python中argparse模块的使用
- SQL Server 性能调优(一)——从等待状态判断系统资源瓶颈【转】
- 解决安装SQL Server2008失败的问题
- mina2.0 spring
- Prism之使用EventAggregation进行模块间通信
- Android性能优化之加快应用启动速度
- Spring Aop技术原理分析
- @component @bean区别
- StarUML[3.1.0]官方安装破解版[app.asar]
- 终极 Shell——ZSH
- linux下对clamav杀毒软件的安装和配置
- 【转】SEGGER Embedded Studio 新建stm32f103工程
- Python实现邮件的批量发送
- fiddler抓包常用功能详解
热门文章
- php之bindValue和bindParam的区别
- NodeRED - 全局变量的使用笔记
- linux(9)find命令详解
- Sqoop export参数updatemode两种模式updateonly和allowinsert区别
- 微服务架构学习Day01-SpringBoot入门
- [Python] Uvicorn+FastAPI快速搞定Restful API开发
- 设计模式(二十二)——状态模式(APP抽奖活动+借贷平台源码剖析)
- JavaScript基本包装类介绍
- 还傻傻分不清楚equals和==的区别吗?看完就明白了
- PostCSS All In One