代码如下:

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;放在外面

最新文章

  1. c++堆
  2. 一道常被人轻视的前端JS面试题
  3. 介绍Oedis - Redis OH/RM
  4. 【转】CentOS环境下yum安装LAMP(Linux+Apache+Mysql+php)
  5. 最新版EJS的include函数已支持参数传递
  6. Linux_08------Linux的系统管理
  7. python中argparse模块的使用
  8. SQL Server 性能调优(一)——从等待状态判断系统资源瓶颈【转】
  9. 解决安装SQL Server2008失败的问题
  10. mina2.0 spring
  11. Prism之使用EventAggregation进行模块间通信
  12. Android性能优化之加快应用启动速度
  13. Spring Aop技术原理分析
  14. @component @bean区别
  15. StarUML[3.1.0]官方安装破解版[app.asar]
  16. 终极 Shell——ZSH
  17. linux下对clamav杀毒软件的安装和配置
  18. 【转】SEGGER Embedded Studio 新建stm32f103工程
  19. Python实现邮件的批量发送
  20. fiddler抓包常用功能详解

热门文章

  1. php之bindValue和bindParam的区别
  2. NodeRED - 全局变量的使用笔记
  3. linux(9)find命令详解
  4. Sqoop export参数updatemode两种模式updateonly和allowinsert区别
  5. 微服务架构学习Day01-SpringBoot入门
  6. [Python] Uvicorn+FastAPI快速搞定Restful API开发
  7. 设计模式(二十二)——状态模式(APP抽奖活动+借贷平台源码剖析)
  8. JavaScript基本包装类介绍
  9. 还傻傻分不清楚equals和==的区别吗?看完就明白了
  10. PostCSS All In One