npm install vue-waterfall-photo -S
import VueWaterfallPhoto from 'vue-waterfall-photo';
export default {
name: "app",
components: {
VueWaterfallPhoto
}
}
<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>
<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>
Don’t change imageList
use
this.$ref.waterfall.addItem({})
this.$ref.waterfall.joinItem([])
{
src:"https://raw.githubusercontent.com/SUNbrightness/my-img/master/WeChatdf46e4c89629031d2e0e4da40bd81041.png",
height:300,
width:300,
}