modalError.vue 错误提示框 vue2 iview
需求
一个错误提示框,后台需要有换行,默认没有换行,做一个支持换行的全局错误提示函数。
注意
代码只展示原理,直接不能使用,里面有getAc,有需要参考 https://www.cnblogs.com/pengchenggang/p/17037428.html
预览
modalError代码
<template>
<div>
<Modal v-model="confirmZenVmodel"
:mask-closable="false"
width="700px"
footer-hide
:closable="false">
<div style="padding: 10px 40px 10px 20px;">
<Row>
<Col span="2"><i class="ivu-icon ivu-icon-ios-close-circle"
style="color: #ed4014; font-size:28px; float: right; margin-right: 10px;"></i></Col>
<Col span="22">
<div style="font-size: 18px; font-weight: bold; margin-top: 2px; margin-bottom: 10px;">错误信息</div>
<div v-html="text" style="min-height: 70px; max-height: 380px; overflow: auto; font-size: 12px;"></div>
</Col>
</Row>
<div>
<Button type="primary"
style="float: right; margin-top: 10px;"
@click="okBtnHandle">确定</Button>
</div>
<div style="clear: both;"></div>
</div>
</Modal>
</div>
</template>
<script>
export default {
name: 'ConfirmZen',
data () {
return {
text: 'defaultText',
confirmZenVmodel: false,
baseOption: {
text: 'defaultText',
}
}
},
methods: {
cancelBtnHandle () {
this.cancelBtnHandleInner()
},
cancelBtnHandleInner (ctx, next) {
this.confirmZenVmodel = false
},
okBtnHandle () {
this.okBtnHandleInner()
},
okBtnHandleInner (ctx, next) {
this.confirmZenVmodel = false
},
open (option) {
const opt = { ...this.baseOption, ...option }
console.info('ConfirmZen open methods', opt)
if (option.cancelBtnHandle) {
this.cancelBtnHandle = () => {
this.$getAc()
.use(option.cancelBtnHandle)
.use(this.cancelBtnHandleInner)
.run()
}
}
if (option.okBtnHandle) {
this.okBtnHandle = () => {
this.$getAc()
.use(option.okBtnHandle)
.use(this.okBtnHandleInner)
.run()
}
}
this.text = opt.text
this.confirmZenVmodel = true
}
}
}
</script>
<style scoped>
</style>
App.vue 绑定
<template>
<div id="app">
<router-view />
<modalError ref="modalErrorRef"></modalError>
</div>
</template>
<script>
import modalError from '@/components/modalError/modalError.vue'
import Vue from 'vue'
export default {
name: 'App',
components: {
modalError,
},
mounted () {
Vue.prototype.$modalError = this.$refs.modalErrorRef
},
</script>
代码使用
if (res.status === 43) {
this.$modalError.open({
text: JSON.parse(res.msg).join('<br><br>')
})
}
modalError.vue 错误提示框 vue2 iview的更多相关文章
- vue错误提示 Cannot read property 'beforeRouteEnter' of undefined,刷新后跳到首页
vue错误提示 Cannot read property 'beforeRouteEnter' of undefined,刷新后跳到首页 因为vue-router版本太高了,我vue用的是2.3.4, ...
- vue 自定义 提示框(Toast)组件
1.自定义 提示框 组件 src / components / Toast / index.js /** * 自定义 提示框( Toast )组件 */ var Toast = {}; var sho ...
- PLSQL登录失败出现空白错误提示框的问题
安装win7后其他软件运行正常,可是数据库用cmd plsplus和plsql软件都连不上,plsql报一个空白提示框 重装n遍oracle客户端,都不行. 最后发现解决方式很简单,在plsql的图标 ...
- ValidationSummary控件不弹出错误提示框
采用VS2013 编写的前台,运用ValidationSummary控件时,不出现错误弹窗,网上找到了解决方法 发现是ASP.NET 4.5对验证控件的影响(兼容性),使用ASP.NET 4.5的解决 ...
- 安装软件(名称不记得了)后,系统开机提示 visual studio just-in-time debugger窗口(WINDOWS错误提示框)
出现这种情况,往往是因为原先安装有VS,后来因某些原因(比如:卸载)导致VS无法使用!!当系统中的有些软件出现错误时,会自动调用vs进行调试,但因为VS无法使用,就出现了visual studio j ...
- Process启动.exe,当.exe内部抛出异常时,总会弹出一个错误提示框,阻止Process进入结束
public class TaskProcess { [DllImport("kernel32.dll", SetLastError = true)] public static ...
- webstorm去掉vue错误提示
- WPF 设置WebBrowser控件不弹脚本错误提示框
using System.Reflection; using System.Windows; using System.Windows.Controls; using System.Windows.N ...
- Jquery 错误提示插件
这是一个简单的输入框错误提示插件,可拓展! .jq-error{ font-size:12px; min-width:150px; width:auto; max-width:350px; line- ...
- Java的awt包的使用实例和Java的一些提示框
一.awt的一些组件 Label l1=new Label("姓名:"); //标签 Label l2=new Label("密码:"); TextField ...
随机推荐
- 【1】paddle飞桨框架高层API使用讲解
1.高层API简介 飞桨框架2.0全新推出高层API,是对飞桨API的进一步封装与升级,提供了更加简洁易用的API,进一步提升了飞桨的易学易用性,并增强飞桨的功能. 飞桨高层API由五个模块组成:数据 ...
- Linux进程间通信 [补档-2023-07-27]
Linux进程间通信 10-1 简介 在Linux下,进程之间相互独立,每个进程都有自己不同的用户地址空间.任何一个进程的全局变量在另 一个进程中都看不到,所以进程和进程之间不能相互访问.如果非要 ...
- element实现大图预览和图片动态加载
element的el-image组件支持大图预览模式,但需要和小图模式配合使用,项目中刚好有需求需要直接使用大图预览并且需要支持图片的动态加载,研究了一下el-image组件的源码发现el-image ...
- Leetcode刷题第二天-贪心
655:非递减数列 链接:665. 非递减数列 - 力扣(LeetCode) 直接找最大最小值进行替换不行,[1,5,4,6,7,8,9]最大最小值所处位置可能是非递减数列 如果nums[i]> ...
- 使用C语言构建一个独立栈协程和共享栈协程的任务调度系统
使用了标准库头文件 <setjmp.h>中的 setjmp 和 longjmp两个函数,构建了一个简单的查询式协作多任务系统,支持独立栈和共享栈两种任务. 其中涉及到获取和设置栈的地址操作 ...
- ADG备库中某个PDB缺失temp文件
之前认为缺失的temp文件在开库时会自动创建,但其实也有不能自动创建的场景,alert会有类似如下提示: 2023-05-11T20:35:35.974983+08:00 AWR(6):******* ...
- 4.if语句--《Python编程:从入门到实践》
4.1 检查多个条件 1.使用 and 检查多个条件 2.使用 or 检查多个条件 4.2 检查特定值是否包含在列表中 使用 in 检查特定值是否在列表中 >>> req ...
- frmClientDm.ItemInLogShowAdq.Delete 报【BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。】
当Adoquery 中只有一条数据库的时候,这个时候删除 就会报 :BOF 或 EOF 中有一个是"真",或者当前的记录已被删除,所需的操作要求一个当前的记录.这个错误 导致这个错 ...
- 承前启后,Java对象内存布局和对象头
承前启后,Java对象内存布局和对象头 大家好,我是小高先生.在我之前的一篇文章<并发编程防御装-锁(基础版)>中,我简要介绍了锁的基础知识,并解释了为什么Java中的任何对象都可以作为锁 ...
- Java I/O 教程(六) BufferedInputStream 类
Java BufferedInputStream Class Java BufferedInputStream class 用于从输入流读取数据,和BufferedOutStream一样内部使用缓冲机 ...