$msgbox
this.$message(`开发中,敬请期待…`); this.$message.success(`成功消息`); this.$message.error(`错误消息`); this.$message.warning(`警告消息`); this.$message({ dangerouslyUseHTMLString: true, message:`<b>支持HTML</b>`,, })
$alert
this.$alert(`开发中,敬请期待…`); this.$alert(`开发中,敬请期待…`, `标题名称`, { dangerouslyUseHTMLString: true, closeOnPressEscape: true, closeOnClickModal: true, confirmButtonText: `我知道了`, }); this.$alert(`开发中,敬请期待…`, `提示`, { dangerouslyUseHTMLString: true, confirmButtonText: `我知道了`, }).then(() => { this.$message.success(`我真的知道了`); });
$confirm
this.$confirm( `此操作将永久删除此数据,是否继续?`, `提示`, { dangerouslyUseHTMLString: true, confirmButtonText: `确定`, cancelButtonText: `取消`, type: "warning" }). then(()=> { //this.$message.success(`删除成功`); }).catch(()=> { //this.$message(`已取消删除`); });
$prompt
this.$prompt(``, `输入文件名`, { closeOnClickModal: false, //是否可通过点击遮罩关闭 MessageBox confirmButtonText: "确定", cancelButtonText: "取消", inputPlaceholder: `请输入文件名`, //输入框的占位符 inputValue: `新建文件夹`, //输入框的初始文本 inputValidator: (value) => { if (value.trim() === ``) return `请输入内容`; let maxLength = 20; if (value.length > maxLength) return `长度不能超过${maxLength}`; }, beforeClose: (action, instance, done) => { let loading = () => ( (instance.confirmButtonLoading = true), (instance.confirmButtonText = `创建中...`) ); let close = () => (done(), (instance.confirmButtonLoading = false)); if (action !== `confirm`) return close(); let value = instance.inputValue.trim(); //获取输入的内容 loading(); // 调用接口API setTimeout(() => { close(); console.log(`输入的内容是:`, value); }, 1000); }, });