1.0.3 • Published 4 years ago

vue-waterfall-photo v1.0.3

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

vue-waterfall-photo

show

show

Project setup

npm install vue-waterfall-photo -S
import VueWaterfallPhoto from 'vue-waterfall-photo';
    export default {
        name: "app",
        components: {
            VueWaterfallPhoto
        }
    }

Simple

<template>
    <div >
            <vue-waterfall-photo :lineGap="0.5" :grow="3" :initList="imageList">
            </vue-waterfall-photo>
    </div>
</template>
<script>
    import VueWaterfallPhoto from 'vue-waterfall-photo';
    export default {
        name: "app",
        components: {
            VueWaterfallPhoto
        },
        data:function(){
            return {
                imageList:[
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic.jpg",height:300,width:300},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic0.jpg",height:300,width:300},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic1.jpg",height:100,width:100},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic2.jpg",height:100,width:100},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic7.jpg",height:1188,width:1200},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic4.jpg",height:300,width:300},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic5.jpg",height:300,width:300},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic6.jpg",height:300,width:300},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic7.jpg",height:1188,width:1200},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic8.jpg",height:300,width:300},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic9.jpg",height:2315,width:2315},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pavlova.jpg",height:853,width:1280},
                    {src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/test/pic.jpg",height:300,width:300},
                    
                ]
            }
        }
    };
</script>

slot

  <vue-waterfall-photo ref="waterfall" :lineGap="0.5" :grow="3" :initList="imageList">
                 <template v-slot="{ item }">
                        <img  :src="'http://'+item.src"></img>
                    </template>
            </vue-waterfall-photo>

performance

Don’t change imageList


use
this.$ref.waterfall.addItem({})
this.$ref.waterfall.joinItem([])

initList

{
    src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/WeChatdf46e4c89629031d2e0e4da40bd81041.png",
    height:300,
    width:300,
}

prop

requiredAttributetypedefaultexplain
trueinitListArray[]初始值
flaselineGapNumber <1001图片间隔距离
flasegrowNumber2列数
flasedataKeyObject{height:'height',width:'width',id:'id'}属性映射

methods

methodexplain
addItem({})新增单个数据
joinItem([])新增一组数据
refresh()初始化

If don’t use add method, It’s also true.

use add method is improve performance.

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago