import {ElMessage,ElMessageBox,ElNotification,ElLoading,type ElMessageBoxOptions} from 'element-plus'import type { LoadingInstance } from 'element-plus/es/components/loading/src/loading'export class Feedback {private loadingInstance: LoadingInstance | null = nullstatic instance: Feedback | null = nullstatic getInstance() {return this.instance ?? (this.instance = new Feedback())}// 消息提示msg(msg: string) {ElMessage.info(msg)}// 错误消息msgError(msg: string) {ElMessage.error(msg)}// 成功消息msgSuccess(msg: string) {ElMessage.success(msg)}// 警告消息msgWarning(msg: string) {ElMessage.warning(msg)}// 弹出提示alert(msg: string) {ElMessageBox.alert(msg, '系统提示')}// 错误提示alertError(msg: string) {ElMessageBox.alert(msg, '系统提示', { type: 'error' })}// 成功提示alertSuccess(msg: string) {ElMessageBox.alert(msg, '系统提示', { type: 'success' })}// 警告提示alertWarning(msg: string) {ElMessageBox.alert(msg, '系统提示', { type: 'warning' })}// 通知提示notify(msg: string) {ElNotification.info(msg)}// 错误通知notifyError(msg: string) {ElNotification.error(msg)}// 成功通知notifySuccess(msg: string) {ElNotification.success(msg)}// 警告通知notifyWarning(msg: string) {ElNotification.warning(msg)}// 确认窗体confirm(msg: string) {return ElMessageBox.confirm(msg, '温馨提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'})}// 提交内容prompt(content: string, title: string, options?: ElMessageBoxOptions) {return ElMessageBox.prompt(content, title, {confirmButtonText: '确定',cancelButtonText: '取消',...options})}// 打开全局loadingloading(msg: string) {this.loadingInstance = ElLoading.service({lock: true,text: msg})}// 关闭全局loadingcloseLoading() {this.loadingInstance?.close()}}const feedback = Feedback.getInstance()export default feedback
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。