img 加载 svg占位符_SVG组件可创建占位符加载,例如Facebook卡加载

img 加载 svg占位符

Vue内容加载器 (vue-content-loader)

SVG component to create placeholder loading, like Facebook cards loading.

SVG组件,用于创建占位符加载,例如Facebook卡加载。

特征 (Features)

This is a Vue port for react-content-loader.

这是react-content-loader的Vue端口。

  • Completely customizable: you can change the colors, speed and sizes.

    完全可定制:您可以更改颜色,速度和大小。

  • Create your own loading: use the online tool to create your custom loader easily.

    创建自己的加载程序:使用在线工具轻松创建自定义加载程序。

  • You can use it right now: there are a lot of presets already.

    您现在可以使用它:已经有很多预设。

  • Performance:

    性能:

    • Tree-shakable and highly optimized bundle.

      可摇树且高度优化的捆绑包。
    • Pure SVG, so it's works without any javascript, canvas, etc.

      纯SVG,因此无需任何JavaScript,canvas等即可使用。
    • Pure functional components.

      纯功能组件。

安装 (Install)

yarn add vue-content-loader

用法 (Usage)

👀👉 Demos: Storybook | with Nuxt.js

👀👉演示: 故事书 | 与Nuxt.js

<template>
  <content-loader></content-loader>
</template>

<script>
import { ContentLoader } from 'vue-content-loader'

export default {
  components: {
    ContentLoader
  }
}
</script>

内置装载机 (Built-in loaders)

import {
  ContentLoader,
  FacebookLoader,
  CodeLoader,
  BulletListLoader,
  InstagramLoader,
  ListLoader
} from 'vue-content-loader'

ContentLoader is a meta loader while other loaders are just higher-order components of it. By default ContentLoader only displays a simple rectangle, here's how you can use it to create custom loaders:

ContentLoader是一个元加载器,而其他加载器只是它的高阶组件。 默认情况下, ContentLoader仅显示一个简单的矩形,这是使用它创建自定义加载器的方法:

<ContentLoader>
  <rect x="0" y="0" rx="3" ry="3" width="250" height="10" />
  <rect x="20" y="20" rx="3" ry="3" width="220" height="10" />
  <rect x="20" y="40" rx="3" ry="3" width="170" height="10" />
  <rect x="0" y="60" rx="3" ry="3" width="250" height="10" />
  <rect x="20" y="80" rx="3" ry="3" width="200" height="10" />
  <rect x="20" y="100" rx="3" ry="3" width="80" height="10" />
</ContentLoader>

API (API)

道具 (Props)

PropTypeDefaultDescription
widthnumber400
heightnumber130
speednumber2
preserveAspectRatiostring'xMidYMid meet'
primaryColorstring'#f9f9f9'
secondaryColorstring'#ecebeb'
uniqueKeystringrandomId()Unique ID, you need to make it consistent for SSR
animatebooleantrue
Struts 类型 默认 描述
宽度 400
高度 130
速度 2
reserveAspectRatio 'xMidYMid meet'
primaryColor '#f9f9f9'
secondaryColor '#ecebeb'
uniqueKey randomId() 唯一ID,您需要使其与SSR保持一致
动画 布尔值 true

翻译自: https://vuejsexamples.com/svg-component-to-create-placeholder-loading-like-facebook-cards-loading/

img 加载 svg占位符

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值