Comments (10)
我目前还没发现有这个问题,请提供一下现在demo,可以吗?
from vue-lazyload.
main.js
import lazyload from 'vue-lazyload'
Vue.use(lazyload, {
error: '../static/lazyload/error.png',
loading: '../static/lazyload/loading.gif',
try: 1 // default 1
})
测试的vue hello.vue
<template>
<div class="hello">
<h1>{{ msg }}</h1>
没有v-for
{{imgdata[0]['fdcImage']}}
<img v-lazy="imgdata[0]['fdcImage']">
有v-for
<img v-for="v in imgdata" v-lazy="v.fdcImage">
</div>
</template>
<script>
export default {
data () {
return {
msg: 'Hello World!',
imgdata:[],
}
},
ready:function(){
this.getData()
},
methods:{
getData:function(){
var _this = this
setTimeout(function() {
_this.imgdata = [{"ID": "1", "fdiType": "1", "fdcName": "首页轮播图1", "fdcImage": "http://exy.wzjo2o.com/uploads/slide.png"}]
}, 200);
}
}
}
</script>
http://dev.wzjo2o.com/uploads/2/201607/result.png
应该是由于发ajax请求获取数据有一定的延迟后 导致的问题 这里用setTimeout 模拟延迟
from vue-lazyload.
你这样使用会在imgdata被加载完成之前是绑定的值会是undefined,我现在增加了对 src 类型为undefined的不进行处理
from vue-lazyload.
已经在 0.4.6 修复了这个问题
from vue-lazyload.
0.4.6在哪儿看 我昨天下载的 还是有这样的问题。
from vue-lazyload.
@liuzhibin123 请使用 npm 升级到最新版本 0.7.5
from vue-lazyload.
@hilongjw 你好!
我看了下 我的是"vue-lazyload": "^0.7.5", 但还是有几个问题
1、加载前只能用一种图片来代替吗?我有几个规格尺寸的图片,所以我想针对不同大小的图片来定义相应的 loading时图片。
2、只有在v-for中有用 其他情况没有用。
请教 我该怎么解决?
from vue-lazyload.
@liuzhibin123 对于单独定制loading 图片 我尽快会加上这个功能。对于非 v-for的问题,,我测试时没有遇到这个问题。
from vue-lazyload.
@hilongjw 大哥能给个QQ吗 我的494227683 邮箱也是这个 ,我的真没效果 我给demo你看
from vue-lazyload.
在v-for中,使用v-lazy,在切换图片时会切换不过来,怎么回事
from vue-lazyload.
Related Issues (20)
- [Vue warn]: Failed to resolve directive: lazy (getting this error since last update) HOT 3
- 最新版本`1.3.4`的产物中将const 编译了进去,会导致在ios9中执行报错 HOT 4
- bug: lazy-compoent slots will lost its data binding, unless use ':key' to replace self.
- 只有界面滚动才会触发 HOT 2
- vue2和vue3版本安装方式都一样的,怎么去区分呢 HOT 1
- Warnings in Vue 2.6.12 HOT 5
- Is there a way to prevent console logging 404 error?
- My image called two times
- 图片非常多,内存没被释放,页面卡死崩溃 HOT 1
- 图片缓存后再次获取naturalWidth/Height大小为0 HOT 1
- not working with vue slick
- Can't resolve lazy directive in SSR
- How to use in Nuxt.js 3? HOT 1
- nuxt3下将v-lazy认为是vue指令,导致服务端SSR启用。 HOT 2
- img.crossorigin = 'anonymous' HOT 1
- 这个触发是按照屏幕上看到的图片来吗
- [email protected] tag HOT 1
- Solution to error reporting in nuxt3 getSSRProps HOT 1
- Solution to Nuxt3 getSSRProps Error HOT 5
- v-lazy-container Nuxt3 in repeated loading HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-lazyload.