当vue 页面加载数据时显示 加载loading
参考:https://www.jianshu.com/p/104bbb01b222
Vue 页面加载数据之前增加 `loading` 动画
创建组件
1、新建 .vue 文件: src -> components -> laoding -> index.vue
2、编辑 index.vue 文件
<template>
<div class="loading"></div>
</template> <script>
export default {
name: "loading"
}
</script> <style scoped>
.loading {
position: fixed;
left: 20%;
top: 20%;
background: url('../../assets/images/load2.gif') center center no-repeat ;
width: 50vw;
height: 50vh;
z-index: 1000;
} </style>
使用组件
isLoading 初始化为 true ,在数据请求成功之后将变量改为 false ,在 template 中通过变量来控制是否显示隐藏,使用 vue 自带的 过渡效果 增加用户体验需要在全局的 css 中加入过渡需要的样式 globle.css
.fade-enter,
.fade-leave-active {
opacity: 0;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.vue 文件使用代码示例片段
<el-table-column prop="salechnl" label="销售渠道" width="200" align="center"></el-table-column>
<el-table-column prop="riskname" label="险种名称" width="200" align="center"></el-table-column>
</el-table>
<!-- 分页 -->
<!-- <div align="right" style="margin-top: 20px;margin-right:245px">-->
<!-- <el-pagination-->
<!-- background-->
<!-- @size-change="handleSizeChange"-->
<!-- @current-change="handleCurrentChange"-->
<!-- :current-page.sync="currentPage"-->
<!-- :page-sizes="pageCount"-->
<!-- :page-size="5"-->
<!-- layout="sizes, prev, pager, next, jumper,total"-->
<!-- :total="count"-->
<!-- ></el-pagination>-->
<!-- </div>-->
<transition name="fade">
<loading v-if="isLoading"></loading>
</transition> </div> </div>
</template>
<script>
import http from '../../../assets/js/http'
import Loading from '../../../components/loading/index'
export default {
components:{ Loading },
data() {
return { isLoading: false,
dData: [],
methods: {
loadData(){
this.isLoading = true;
var data = {};
//参数
let userInfo = Lockr.get('userInfo')
if (this.formInline.contract_start_date != '' ) {
data.contract_start_date = this.formatter(this.formInline.contract_start_date, "yyyy-MM-dd")
} else {
data.contract_start_date = "";
};
if (this.formInline.contract_end_date != '' ) {
data.contract_end_date = this.formatter(this.formInline.contract_end_date, "yyyy-MM-dd")
} else {
data.contract_end_date = this.formInline.contract_end_date
};
console.log("%c -------传递额参数-----","color:green");
console.log(data);
this.apiPost('underwritelist/queryunderwritelist', data).then((res) => {
console.log(res);
this.tableData=[];
this.handelResponse(res, (data) => {
console.log(res);
this.tableData = data.list;
this.count = data.total;
this.isLoading = false;
})
});
},
当vue 页面加载数据时显示 加载loading的更多相关文章
- viewPager使用时加载数据时显示IllegalStateException异常,解决不了。。。。
从newsPager中得到newsDetailTitles标题的详细内容,这是通过构造器传过来的.打印日志78行能打印,45行打印出来共size是12.但是程序出现了异常java.lang.Illeg ...
- jquery加载数据时显示loading加载动画特效
插件下载:http://www.htmleaf.com/jQuery/Layout-Interface/201505061788.html 插件使用: 使用该loading加载插件首先要引入jQuer ...
- jquery mobile 请求数据方法执行时显示加载中提示框
在jquery mobile开发中,经常需要调用ajax方法,异步获取数据,如果异步获取数据方法由于网速等等的原因,会有一个反应时间,如果能在点击按钮后数据处理期间,给一个正在加载的提示,客户体验会更 ...
- 解决easyui datagrid加载数据时,checkbox列没有根据checkbox的值来确定是否选中
背景: 昨天帮朋友做一个easyui datagrid的小实例时,才发现easyui datagrid的checkbox列,没有根据值为true或false来选中checkbox,当时感觉太让人失 ...
- vue 中监测滚动条加载数据(懒加载数据)
vue 中监测滚动条加载数据(懒加载数据) 1:钩子函数监听滚动事件: mounted () { this.$nextTick(function () { window.addEventListene ...
- Fullcalendar改版后发布到IIS或者tomcat里面前端加载数据不显示的问题
问题如题:Fullcalendar改版后发布到IIS或者tomcat里面前端加载数据不显示的问题 解决办法:通过火狐浏览器工具发现是时间格式不对的原因,需要将时间格式修改为:yyyy-MM--DD ...
- easyui datagrid 异步加载数据时滚动条有时会自动滚到最底部的问题
在使用easyui 的datagrid异步加载数据时发现滚动条有时会自动滚到最底部.经测试发现,如果加载数据前没有选中行则不会出现这个问题.这样我们可以在重新异步加载数据前取消选中行就可以避免这个问题 ...
- 实现easyui datagrid在没有数据时显示相关提示内容
本示例实现easyui datagrid加载/查询数据时,如果没有相关记录,则在datagrid中显示没有相关记录的提示信息,效果如下图所示 本实例要实现如下图所示的效果: 本示例easyui版本为1 ...
- easy ui datagrid在没有数据时显示相关提示内容
$(function () { $('#dg').datagrid({ fitColumns: true, url: 'product.json', pagination: true, pageSiz ...
随机推荐
- 【题解】poj 3254 Corn Fields
题目描述 农场主John新买了一块长方形的新牧场,这块牧场被划分成M行N列(1 ≤ M ≤ 12; 1 ≤ N ≤ 12),每一格都是一块正方形的土地.John打算在牧场上的某几格里种上美味的玉米,供 ...
- noip2012 总结
Vigenère 密码 题目描述 16 世纪法国外交家 Blaise de Vigenère 设计了一种多表密码加密算法――Vigenère 密码.Vigenère 密码的加密解密算法简单易用,且破译 ...
- GetModuleFileName函数的用法
函数的功能 获取exe可执行文件的绝对路径. 用法 通过获取到exe的路径,可以获取到程序路径下(父路径或者子路径)的一些其它文件路径. 函数原型 DWORD WINAPI GetModuleFile ...
- 对比 Verilog 和 SystemVerilog 中的基本数据类型
作为引子,首先来看一段描述,该段介绍了SystemVerilog对比Verilog在RTL设计和建模时的新特性之一(logic数据类型),然后下文我再展开对比介绍Verilog和SystemVeril ...
- 微信小程序 添加左边固定浮动框
view: <!-- 悬浮框 --> <view class="v-fixed-title1"> <view class="v-fixed- ...
- WebSocket实现前后端通讯
WebSocket实现前后端通讯 长安如梦里,何日是归期. 简介:我们上线了一个商城项目,移交运营团队使用之后,他们要求商城有新订单来的时候同时加上声音提示,让她们可以及时知道有单来了.我这边想了想, ...
- POJ 1279 Art Gallery 半平面交 多边形的核
题意:求多边形的核的面积 套模板即可 #include <iostream> #include <cstdio> #include <cmath> #define ...
- AcWing 1289. 序列的第k个数
BSNY 在学等差数列和等比数列,当已知前三项时,就可以知道是等差数列还是等比数列. 现在给你 整数 序列的前三项,这个序列要么是等差序列,要么是等比序列,你能求出第k项的值吗. 如果第k项的值太大, ...
- MinIO关闭公开桶的列表展示(S3 browser)
MinIO通过配置桶策略关闭列表展示,以下为操作教程. 下载:s3browser官网 安装完成S3 browser后,添加账号 修改桶policy,选择桶public右键 删除 s3:ListBuck ...
- SpringCloud:eureka的'eurekaAutoServiceRegistration'报错解决方法
报错信息如下: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with ...