vue渐隐渐现的插件_Vue渐进式图像加载器插件,例如Medium

本文介绍了Vue渐进式图像加载器插件——vue-image-loader,用于实现类似Medium的图像加载体验。安装后,你可以使用全局组件来替代常规的`<img>`标签,同时支持传递占位符图像,以便在加载过程中提供模糊反馈。
摘要由CSDN通过智能技术生成

vue渐隐渐现的插件

Vue图像加载器 (vue-image-loader)

Vue progressive image loading plugin.

Vue渐进式图像加载插件。

example

安装 (Installation)

$ npm install @kevindesousa/vue-image-loader

用法 (Usage)

import Vue from 'vue'
import VueImageLoader from '@kevindesousa/vue-image-loader'

Vue.use(VueImageLoader)
渐进式装载机图像 (Progressive loader image)

Instead of using the normal img tag to load images

而不是使用常规的img标签加载图像

<img src="https://images.pexels.com/photos/33109/fall-autumn-red-season.jpg?fit=crop&crop=entropy&w=3456&h=2304" />

use the image-loader component already globally available after the plugin installation

使用插件安装后已经全局可用的image-loader组件

<image-loader
  src="https://images.pexels.com/photos/33109/fall-autumn-red-season.jpg?fit=crop&crop=entropy&w=3456&h=2304"
  width="864px"
  height="476px" />

占位符 (Placeholders)

To be able to immediately show some feedback to the user, it is possible to pass a placeholder image, which could be also 1% the size of the main image: it will be blurred so you can go crazy with optimizations here.

为了能够立即向用户显示一些反馈,可以传递一个占位符图像,该图像也可以是主图像大小的1%:它将变得模糊,因此您可以在此处进行优化。

in this example I actually use the same image, but you have the idea here

在此示例中,我实际上使用了相同的图像,但是您在这里有了主意

<image-loader
  src="https://images.pexels.com/photos/33109/fall-autumn-red-season.jpg?fit=crop&crop=entropy&w=3456&h=2304"
  placeholder="https://images.pexels.com/photos/33109/fall-autumn-red-season.jpg?w=100"
  width="864px"
  height="476px"
/>

翻译自: https://vuejsexamples.com/vue-progressive-image-loader-plugin-like-medium/

vue渐隐渐现的插件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值