Git Product home page Git Product logo

Comments (10)

hilongjw avatar hilongjw commented on July 26, 2024

我目前还没发现有这个问题,请提供一下现在demo,可以吗?

from vue-lazyload.

1042782229 avatar 1042782229 commented on July 26, 2024

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.

hilongjw avatar hilongjw commented on July 26, 2024

你这样使用会在imgdata被加载完成之前是绑定的值会是undefined,我现在增加了对 src 类型为undefined的不进行处理

from vue-lazyload.

hilongjw avatar hilongjw commented on July 26, 2024

已经在 0.4.6 修复了这个问题

from vue-lazyload.

liuzhibin123 avatar liuzhibin123 commented on July 26, 2024

0.4.6在哪儿看 我昨天下载的 还是有这样的问题。

from vue-lazyload.

hilongjw avatar hilongjw commented on July 26, 2024

@liuzhibin123 请使用 npm 升级到最新版本 0.7.5

from vue-lazyload.

liuzhibin123 avatar liuzhibin123 commented on July 26, 2024

@hilongjw 你好!
我看了下 我的是"vue-lazyload": "^0.7.5", 但还是有几个问题
1、加载前只能用一种图片来代替吗?我有几个规格尺寸的图片,所以我想针对不同大小的图片来定义相应的 loading时图片。
2、只有在v-for中有用 其他情况没有用。
请教 我该怎么解决?

from vue-lazyload.

hilongjw avatar hilongjw commented on July 26, 2024

@liuzhibin123 对于单独定制loading 图片 我尽快会加上这个功能。对于非 v-for的问题,,我测试时没有遇到这个问题。

from vue-lazyload.

liuzhibin123 avatar liuzhibin123 commented on July 26, 2024

@hilongjw 大哥能给个QQ吗 我的494227683 邮箱也是这个 ,我的真没效果 我给demo你看

from vue-lazyload.

SmallBlockCat avatar SmallBlockCat commented on July 26, 2024

在v-for中,使用v-lazy,在切换图片时会切换不过来,怎么回事

from vue-lazyload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.