文件夹:msgBox.ts
/**
 * 时间:2020/11/20
 * Created by dingwangjun on 
 * 说明:消息
 */

import { ElNotification, ElMessage,ElMessageBox } from 'element-plus'
/**
 * 如何调用,如下面调用案例
 * import {succesMsg,warnMsg,infoMsg,
     errorMsg,alertBox,confirmBox} from '@/utils/msgBox.ts'

  confirmBox('确认删除该标签吗?','确定',null).then(res => {
    alert("确定:"+res)
  }).catch(res => {
    alert("取消关闭:"+res)
  })
 * */

// 成功提示信息
export function succesMsg(msgInfo){
  ElMessage({
    type: 'success',
    showClose: true,
    dangerouslyUseHTMLString: true,
    message: msgInfo,
  })
}

// 警告提示信息
export function warnMsg(msgInfo){
  ElMessage({
    type: 'warning',
    showClose: true,
    dangerouslyUseHTMLString: true,
    message: msgInfo,
  })
}

// 错误提示信息
export function errorMsg(msgInfo){
  ElMessage({
    type: 'error',
    showClose: true,
    dangerouslyUseHTMLString: true,
    message: msgInfo,
  })
}

// 一般信息提示信息
export function infoMsg(msgInfo){
  ElMessage({
    type: 'info',
    showClose: true,
    dangerouslyUseHTMLString: true,
    message: msgInfo,
  })
}

// 确定一个确定按钮alertBox
export function alertBox(msg,btnName,type) {
  let confirmName = btnName == '确定'? '确定' : '是'
  return ElMessageBox.alert(msg, '提示',{
    type: type,
    confirmButtonText: confirmName,
    dangerouslyUseHTMLString: true
  });
}

// 确定取消;是否按钮弹出框
export function confirmBox(msg,btnName,type) {
  let confirmName = btnName == '确定'? '确定' : '是'
  let cancelsName = btnName == '确定'? '取消' : '否'
  return ElMessageBox.confirm(msg,'提示', {
    type: type,
    confirmButtonText: confirmName,
    cancelButtonText: cancelsName,
    closeOnClickModal: false,
    closeOnPressEscape: false,
    dangerouslyUseHTMLString: true
  })
}



GitHub 加速计划 / vu / vue
207.52 K
33.66 K
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:1 个月前 )
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 3 个月前
e428d891 Updated Browser Compatibility reference. The previous currently returns HTTP 404. 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐