element确认框封装

公用方法js文件

// 确认框
export function handleConfirm(title = '确认删除吗?',type='warning') {
	return this.$confirm(title, '提示', {
		confirmButtonText: '确定',
		cancelButtonText: '取消',
		type: type
	});
}

main.js引用

import { handleConfirm  } from "。。。";
Vue.prototype.handleConfirm = handleConfirm

页面中使用

 this.handleConfirm()
        .then(() => {
        })
        .catch(() => {
        });

猜你喜欢

转载自blog.csdn.net/qq_52912134/article/details/118755331