我用vue-waterfall做瀑布流布局,希望两列布局,两列都紧靠屏幕两边,中间留出空白。上代码:
<waterfall :line-gap='screenW'>
<!-- each component is wrapped by a waterfall slot -->
<waterfall-slot
v-for="(video, index) in videoList"
class='items'
:width='screenW'
:height='video.height * screenW / video.width + 40'
:order='index'
:key='video.auid'
>
<img :src='video.coverurl' alt="">
<div class='user-info-box'>
<img class='userlogo' :src='video.logourl' alt="">
<span class='userName'>{{ video.username }}</span>
</div>
</waterfall-slot>
</waterfall>
data () {
return {
screenW: window.screen.width * 0.49
}
}
这样做出来是两列紧靠在一起,居左,屏幕右边留白了
然后我给index%2===0的加了marginLeft希望把右边的顶过去,才想起来在左边的index不一定是奇数,请问大神我应该咋办
相关分类