php 延时 加载图片,vue-lazyload - 图片延迟加载实例教程

Usageimport Vue from 'vue'

import VueLazyload from 'vue-lazyload'

Vue.use(VueLazyload, {

preLoad: 1.3,

error: 'dist/error.png',

loading: 'dist/loading.gif',

attempt: 1

})

Options

参数说明

preLoad

描述:

例子:

error

描述:图片加载失败后,的默认图片

例子:error: 'dist/error.png',

loading

描述:图片加载过程中,默认显示的图片设置

例子: loading: 'dist/loading.gif',

attempt

描述:

例子:

listenEvents

描述:监听的事件,默认值 ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove']

例子:listenEvents: [ 'scroll' ]

adapter

描述:

例子:

filter

描述:过滤图片的路径,默认{ }

例子:

lazyComponent

描述:

例子:

实战例子在main.js文件添加:

import VueLazyload from 'vue-lazyload'

Vue.use(VueLazyload, {

// 设置默认显示的图片

loading: require('common/image/default.png')

})

在需要用到延迟加载页面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值