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 ...
随机推荐
- Vue3用户代码片段
1.defineComponent语法 { "Print to console": { "prefix": "vue3", "bo ...
- vue-router.esm.js:2065 Uncaught (in promise) Error: Redirected when going from "/login?redirect=%2Fhome" to "/home" via a navigation guard.
原因: vue-router路由版本更新产生的问题,导致路由跳转失败抛出该错误; 真正的原因是由于返回了一个Promise对象, 正常的跳转由then方法执行 当正常的路由跳转, 被"路 ...
- javascript按钮通过cookie限制60s后才可以点击
javascript按钮通过cookie限制60s后才可以点击 1️⃣ 首先创建一个html页面,放入一个按钮 2️⃣ 设置点击按钮的触发函数 一般当点击按钮都会有一些业务需要,在需求结束后,触发sa ...
- 面试官:你能简单聊聊MyBatis执行流程
本文分享自华为云社区<面试必问|聊聊MyBatis执行流程?>,作者: 冰 河. MyBatis源码解析 大家应该都知道Mybatis源码也是对Jbdc的再一次封装,不管怎么进行包装,还是 ...
- 2022 JuiceFS 社区用户调研结果出炉
为了使 JuiceFS 的发展更贴合用户的真实需求,我们在三周前向社区发出了一份调研问卷.此次调研面向已经将 JuiceFS 应用于生产环境的用户,了解其在应用 JuiceFS 前和使用中的体验与评价 ...
- 使用7-zip进行分卷压缩和解分卷压缩(Windows和Linux)
现在一共有10个视频,一共313M,我对该文件夹进行分卷压缩,每个tar包100M,压缩过程如下: Windows环境首先选中所有的压缩包,然后在压缩包上单击鼠标右键,然后选择7-Zip,再选择提取到 ...
- Spring Boot 1.5.x 结合 JUnit5 进行接口测试
在Spring Boot 1.5.x中,默认使用Junit4进行测试.而在对Controller进行接口测试的时候,使用 @AutoConfigureMockMvc 注解是不能注入 MockMvc 对 ...
- 2023年多校联训NOIP层测试3+「SFCOI-3」Sadness Fan Club Round 3
2023年多校联训NOIP层测试3 T1 数列变换 \(10pts\) 考虑暴力,发现 \(f\) 数列进行一次变换 \(A\) ,再进行一次变换 \(B\) 后,恢复成了原数列: \(f\) 数列进 ...
- 图解3种常见的深度学习网络结构:FC、CNN、RNN
01 全连接网络结构 全连接(FC)网络结构是最基本的神经网络/深度神经网络层,全连接层的每一个节点都与上一层的所有节点相连. 全连接层在早期主要用于对提取的特征进行分类,然而由于全连接层所有的输出与 ...
- java 从零开始手写 redis(七)LRU 缓存淘汰策略详解
前言 java从零手写实现redis(一)如何实现固定大小的缓存? java从零手写实现redis(三)redis expire 过期原理 java从零手写实现redis(三)内存数据如何重启不丢失? ...