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 ...
随机推荐
- Python使用Paramiko实现SSH管理
paramiko 是一个用于在Python中实现SSHv2协议的库,它支持对远程服务器进行加密的通信.目前该模块支持所有平台架构且自身遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接,你 ...
- 8.10 TLS线程局部存储反调试
TLS(Thread Local Storage)用来在进程内部每个线程中存储私有的数据.每个线程都会拥有独立的TLS存储空间,可以在TLS存储空间中保存线程的上下文信息.变量.函数指针等.TLS其目 ...
- 金邦2.5寸SATA固态硬盘R3 2TB开箱
上次帖子里根据坛友的反馈,然后结合狗东的搜索,找了个金邦的2.5寸的SATA的固态硬盘,图的是它的价格和容量.但是我拿到它这个实物的时候还是略有点失望,因为包装太简单,坛友里说估计是贴牌.反正已经入手 ...
- 8、数据库学习规划:MS SQL Server - 学习规划系列文章
微软的SQL Server数据库是笔者最先接触的数据库,虽然之前有Access,但是那个是学校里知道的,没实际去开发基于Access的程序.SQL Server发展到现在已经有很多个版本了,其功能也非 ...
- ABC 314
F 每次相当于创建一个包含 \(p_i,q_i\) 各自所在集合的点的大点 \(u\),然后 \(u\) 向 \(p_i,q_i\) 各自所在集合连边,边权就是胜率. 连完之后求每个点到根结点(\(\ ...
- SpringCloud Bus动态刷新中心化配置
说明 上一篇我们介绍了配置中心实战,并留下了一个配置修改后如何实现自动刷新的问题,下面就实际操作一下,首先是手动刷新单个微服务,其次是利用消息总线实现全部刷新. 手动动态刷新 动态刷新是当远程配置文件 ...
- Java I/O 教程(三) FileOutputStream类
Java FileOutputStream 用于将字节数据写入文件. 如果你需要将原始数据写入文件,就使用FileOutputStream类. Java.io.FileOutputStream cla ...
- jsp中无法识别EL表达式问题
今天在开发系统时需要在JSP中遍历List<javabean>,其中用到了EL表达式:${item.value} 页面死活不出数据,只显示表达式本身:${item.value}. 页面代码 ...
- 掌握云容器网络:何为ipvs
本文分享自华为云社区<[理解云容器网络]2-基础篇-ipvs介绍>,作者: 可以交个朋友. IPVS简介 ipvs是工作在Linux内核态的4层负载均衡:和用户态的负载均衡软件(如ngin ...
- SpringBoot整合aspectj实现面向切面编程(即AOP)
前言 "面向切面编程",这样的名字并不是非常容易理解,且容易产生一些误导.但在实际业务中,AOP有着广泛的用途,比如日志记录,性能统计,安全控制,事务处理,异常处理等等. 举些栗子 ...