当前位置: 首页 > news >正文

elment Loading 加载组件动态变更 text 值bug记录

先上效果图:

倒计时4分钟组件方法

        // 倒计时 4分钟getSencond() {this.countDown = '4分00秒'this.interval = setInterval(() => {this.maxTime--;let minutes = Math.floor(this.maxTime / 60);let seconds = Math.floor(this.maxTime % 60);minutes = minutes < 10 ? '0' + minutes : minutesseconds = seconds < 10 ? '0' + seconds : secondsthis.countDown = minutes + '分' + seconds + '秒'// console.log('countDown:', this.countDown)this.allLoading(this.maxTime, this.countDown,)if (this.maxTime === 0) {clearInterval(this.interval)}}, 1000)},

调用的loading方法

错误的写法:(text 里面给变量,变量值不会更新,只会走一次。)

        allLoading(maxTime, countDown) {const loading = this.$loading({lock: true,text: `请耐心等待导入成功: 倒计时${ countDown }`,spinner: 'el-icon-loading',background: 'rgba(0, 0, 0, 0.7)'})if (maxTime === 0) {loading.close()}},

正确的写法:官方文档里也没有提供能动态改变加载文案的 API,网上看到有人说可以使用 setText 来设置 text 值,于是使用以下方法试了试,还真的可以。

loading.setText(`请耐心等待导入成功: 倒计时${ countDown }`)
        data() {return {countDown: '4分00秒',maxTime: 4 * 60,interval: '',}},allLoading(maxTime, countDown) {const loading = this.$loading({lock: true,text: '正在导入...',spinner: 'el-icon-loading',background: 'rgba(0, 0, 0, 0.7)'})loading.setText(`请耐心等待导入成功: 倒计时${ countDown }`)if (maxTime === 0) {loading.close()}},

改变icon 的图标大小:

element中自带的loading图标修改大小
.el-loading-spinner{
        font-size: 30px;
}
这样就可以直接修改,又得生效不了,前面可以加   ::v-deep

::v-deep   .el-loading-spinner{
        font-size: 30px;
}

http://www.lryc.cn/news/252306.html

相关文章:

  • Typora免费版安装教程(仅供学习)
  • SSM项目实战-前端-添加分页控件-调正页面布局
  • C语言从入门到实战——常用字符函数和字符串函数的了解和模拟实现
  • nodejs+vue+elementui网上家电家用电器数码商城购物网站 多商家
  • 32.768KHz时钟RTC晶振精度PPM值及频差计算
  • SQL Server 数据库,创建数据表
  • Vue3引入markdown编辑器--Bytemd
  • JS实现基数排序
  • 【蓝桥杯】二分查找
  • 大于2T磁盘划分并挂接
  • 蓝桥杯每日一题2023.12.3
  • Nacos源码解读04——服务发现
  • SAP系统邮件功能配置 SCOT <转载>
  • 数据结构——二叉树(相关术语、性质、遍历过程)
  • 详细学习Pyqt5的9种显示控件
  • SpringBoot+vue美食外卖点餐系统的研究与设计
  • 行业分析:轻轨行业发展现状及市场投资前景
  • 智安网络|语音识别技术:从历史到现状与未来展望
  • 揭秘预付费电表怎么无线收费——方便快捷收费
  • OpenCV-Python:图像卷积操作
  • 创建Vue项目
  • T-SQL的多表查询
  • 适合学生备考的护眼台灯有哪些?五款公认优质台灯推荐
  • 机器人学英语
  • 51综合程序03-DS1302时钟
  • redis的缓存击穿,缓存穿透,缓存雪崩
  • AutoHotKey-study
  • Go to do list
  • JWT 认证机制
  • 内核启动时间信息打印