searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

当在js中使用element-ui plus的confirm时,如何通过js关闭对应窗口

2024-07-16 09:32:19
54
0

还是以vue语法为主:

简单在demo.js文件使用elementUI-plus的confirm

import { ElMessageBox } from 'element-plus';

const open = () => {
  ElMessageBox.confirm('我是内容', '我是标题', {
    type: 'warning',
    cancelButtonText: '取消',
    confirmButtonText: '确定',
  }).then(()=>{
    console.debug('我点了确定');
  }).catch(() => {
    console.debug('我点了取消');
  })
}

const close = () => {
  ElMessageBox.close();
  console.debug('我关掉弹窗');
}

通过简单的调用原生的ElMesasgeBox的原生close方法,即可关闭弹窗。

0条评论
0 / 1000
龙****滔
5文章数
0粉丝数
龙****滔
5 文章 | 0 粉丝
原创

当在js中使用element-ui plus的confirm时,如何通过js关闭对应窗口

2024-07-16 09:32:19
54
0

还是以vue语法为主:

简单在demo.js文件使用elementUI-plus的confirm

import { ElMessageBox } from 'element-plus';

const open = () => {
  ElMessageBox.confirm('我是内容', '我是标题', {
    type: 'warning',
    cancelButtonText: '取消',
    confirmButtonText: '确定',
  }).then(()=>{
    console.debug('我点了确定');
  }).catch(() => {
    console.debug('我点了取消');
  })
}

const close = () => {
  ElMessageBox.close();
  console.debug('我关掉弹窗');
}

通过简单的调用原生的ElMesasgeBox的原生close方法,即可关闭弹窗。

文章来自个人专栏
前端组件库
1 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
0
0