0.0.1 • Published 7 years ago

vue-image-plugins v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

getting started

vue-image-plugins

安装

npm install --save vue-image-plugins

使用

<img v-image="{
       url: item.url,
       lazy: true,
       styleConfig: {
         imageViewMode: 1,
         originWidth: item.width,
         originHeight: item.height,
         styleWidth: htmlFontSize * 1.5,
         styleHeight: htmlFontSize * 1.5
       },
       view: {
         imageViewMode: 1,
         format: 'jpg',
         imageViewWidth: htmlFontSize * 1.5 * 2,
         imageViewHeight: htmlFontSize * 1.5 * 2,
         interlace: true
       },
       preview: {
         list: moment.imgs,
         index: $index,
       },
       defaultImage: {
         type: normal
       },
       placeHolder: {
       }
     }"
     v-lazy="item.url"/>

与vue-lazyload的配合(初步验证未通过,应该是vue-lazyload的使用或版本问题)

在vue-lazyload的filter中获取处理过的url,并替换 参考:

https://github.com/hilongjw/vue-lazyload#image-url-filter

Vue.use(vueLazy, {
    filter: {
      imageUrl ({ el, src }) {
        let url = el.getAttribute('image-url')
        return (url ? url : src)
      }
    }
})

note

params

properties

methods

others