原文地址:https://cloud.tencent.com/developer/article/1006169

https://mp.weixin.qq.com/s/qmyn6mGrO6hRKuvKUSF8lA

https://dulinrain.github.io/css/使用Skeleton%20Screens增强网页的感知性能.html

https://codepen.io/janily/pen/rGqQgJ

index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
<style>
.timeline-item {
background: #fff;
border: 1px solid;
border-color: #e5e6e9 #dfe0e4 #d0d1d5;
border-radius: 3px;
padding: 12px;
margin: 0 auto;
max-width: 472px;
min-height: 200px;
} @keyframes placeHolderShimmer{
0% {
background-position: -468px 0
}
100%{
background-position: 468px 0
}
} .animated-background {
animation-duration: 1s;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-name: placeHolderShimmer;
animation-timing-function: linear;
background: #f6f7f8;
background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);
background-size: 800px 104px;
height: 40px;
position: relative;
} .background-masker {
background: #fff;
position: absolute;
} .background-masker.header-top,
.background-masker.header-bottom,
.background-masker.subheader-bottom {
top: 0;
left: 40px;
right: 0;
height: 10px;
} .background-masker.header-left,
.background-masker.subheader-left,
.background-masker.header-right,
.background-masker.subheader-right {
top: 10px;
left: 40px;
height: 8px;
width: 10px;
} .background-masker.header-bottom {
top: 18px;
height: 6px;
} .background-masker.subheader-left,
.background-masker.subheader-right {
top: 24px;
height: 6px;
} .background-masker.header-right,
.background-masker.subheader-right {
width: auto;
left: 300px;
right: 0;
} .background-masker.subheader-right {
left: 230px;
} .background-masker.subheader-bottom {
top: 30px;
height: 10px;
} .background-masker.content-top,
.background-masker.content-second-line,
.background-masker.content-third-line,
.background-masker.content-second-end,
.background-masker.content-third-end,
.background-masker.content-first-end {
top: 40px;
left: 0;
right: 0;
height: 6px;
} .background-masker.content-top {
height:20px;
} .background-masker.content-first-end,
.background-masker.content-second-end,
.background-masker.content-third-end{
width: auto;
left: 380px;
right: 0;
top: 60px;
height: 8px;
} .background-masker.content-second-line {
top: 68px;
} .background-masker.content-second-end {
left: 420px;
top: 74px;
} .background-masker.content-third-line {
top: 82px;
} .background-masker.content-third-end {
left: 300px;
top: 88px;
}
</style>
<body>
<div id="app">
<div v-for="user in users" class="items" v-if="loading">
<user-item :name="user.name" :email="user.email"></user-item>
</div>
<div v-for="load in loades" v-if="!loading">
<loading-item></loading-item>
</div>
</div>
</body>
<script>
// https://cloud.tencent.com/developer/article/1006169
Vue.component('user-item', {
props: ['email', 'name'],
template: `<div>
<h2 v-text="name"></h2>
<p v-text="email"></p>
</div>`
}) Vue.component('loading-item', {
template: `<div class="animated-background">
<div class="background-masker header-top"></div>
<div class="background-masker header-left"></div>
<div class="background-masker header-right"></div>
<div class="background-masker header-bottom"></div>
<div class="background-masker subheader-left"></div>
<div class="background-masker subheader-right"></div>
<div class="background-masker subheader-bottom"></div>
</div>`
}) var app = new Vue({
el: '#app',
data: {
users: [],
loading: false,
loades: 10
},
methods: {
getUserDetails: function() {
fetch('https://jsonplaceholder.typicode.com/users')
.then(result => result.json())
.then(result => {
this.users = result
this.loading = true
});
}
},
beforeMount: function() {
setTimeout(() => {
this.getUserDetails()
}, 3000);
}
});
</script>
</html>

基于Vuejs实现 Skeleton Loading 骨架图的更多相关文章

  1. Skeleton Screen -- 骨架屏--应用

    案例:使用 现已经在支付的项目使用 用户体验一直是前端开发需要考虑的重要部分,在数据请求时常见到锁屏的loading动画,而现在越来越多的产品倾向于使用Skeleton Screen Loading( ...

  2. Skeleton Screen — 骨架屏

    用户体验一直是前端开发需要考虑的重要部分,在数据请求时常见到锁屏的loading动画,而现在越来越多的产品倾向于使用Skeleton Screen Loading(骨架屏)替代,以优化用户体验. Sk ...

  3. 最简单的基于libVLC的例子:最简单的基于libVLC的视频播放器(图形界面版)

    ===================================================== 最简单的基于libVLC的例子文章列表: 最简单的基于libVLC的例子:最简单的基于lib ...

  4. 基于Echarts的股票K线图展示

    发布时间:2018-10-31   技术:javascript+html5+canvas   概述 基于echarts的股票K线图展示,只需引用单个插件,通过简单配置,导入数据,即可实现炫酷复杂的K线 ...

  5. 基于jQuery果冻式按钮焦点图切换代码

    基于jQuery果冻式按钮焦点图切换代码.这是一款基于jQuery+CSS3实现的图片切换代码.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class=&quo ...

  6. 基于js全屏动画焦点图幻灯片

    今天给大家分享一款基于js全屏动画焦点图幻灯片.这款焦点图内的内容以动画形式出现和消失.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class="sl ...

  7. 基于VueJS的render渲染函数结合自定义组件打造一款非常强大的IView 的Table

    基于VueJS的render渲染函数结合自定义组件打造一款非常强大的IView 的Table https://segmentfault.com/a/1190000015970367

  8. css skeleton loading & skeleton components

    css skeleton loading css & :empty See the Pen Skeleton Screen with CSS by xgqfrms (@xgqfrms) on ...

  9. (新手向)基于Bootstrap的简单轮播图的手机实现

    个人电脑里存了不少适合手机欣赏的图片,但是放手机里看是件很占据资源的事.鉴于家里有一台电脑经常开着,正好用来做家庭局域网共享,于是笔者就设想通过一种比较简单环保的思路.通过手机访问电脑内的图片. 首先 ...

随机推荐

  1. Linq-语句之存储过程

    存储过程 在我们编写程序中,往往需要一些存储过程,在LINQ to SQL中怎么使用呢?也许比原来的更简单些.下面我们以NORTHWND.MDF数据库中自带的几个存储过程来理解一下. 1.标量返回 在 ...

  2. (LeetCode 153)Find Minimum in Rotated Sorted Array

    Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...

  3. 安全删除U盘或其他硬件 unlocker的使用方法

    1 假如我在优盘里新建一个文档,并且正在读写文件. 点击右下角的安全删除的时候弹出如下对话框. 2 在该优盘上右击,Unlocker,弹出的对话框显示NOTEPAD.EXE正在使用. 3 在确保左侧是 ...

  4. hdu1027 Ignatius and the Princess II (全排列 &amp; STL中的神器)

    转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1027 Ignatiu ...

  5. 解决百度编辑器在编辑视频时src丢失的问题

    问题描述:使用的是最新的UEditor 1.4.3.3版本,在上传完视频后,编辑的时候出现视频的src丢失的问题 解决方式:修改ueditor.config.js文件,将 img: ['src', ' ...

  6. POJ 1163 The Triangle DP题解

    寻找路径,动态规划法题解. 本题和Leetcode的triangle题目几乎相同一样的,本题要求的是找到最大路径和. 逆向思维.从底往上查找起就能够了. 由于从上往下能够扩展到非常多路径.而从下往上个 ...

  7. EXCEPTION-TOMCAT

      CreateTime--2016年10月24日16:22:12Author:Marydon声明:异常类文章主要是记录了我遇到的异常信息及解决方案,解决方案大部分都是百度解决的,(这里只是针对我遇到 ...

  8. urlparse模块(专门用来解析URL格式)

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #urlparse模块(专门用来解析URL格式) #URL格式: #protocol ://hostname[ ...

  9. 身份证查询API

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #http://apistore.baidu.com/apiworks/servicedetail/113.h ...

  10. http 错误码对照表

    代码 指示 2xx 成功 200 正常:请求已完成. 201 正常:紧接 POST 命令. 202 正常:已接受用于处理,但处理尚未完成. 203 正常:部分信息 — 返回的信息只是一部分. 204 ...