码迷,mamicode.com
首页 > 其他好文 > 详细

瀑布流vue-waterfall的高度设置

时间:2018-01-18 18:03:25      阅读:479      评论:0      收藏:0      [点我收藏+]

标签:limit   html   any   tran   tor   iter   meta   center   animate   

最近用vue做项目,用到了瀑布流vue-waterfall,其中遇到高度的设置问题,大概介绍下,希望可以帮到一些人

1、安装

npm install --save vue-waterfall

2、引入

ES6

* in xxx.vue */

 
import Waterfall from ‘vue-waterfall/lib/waterfall
import WaterfallSlot from ‘vue-waterfall/lib/waterfall-slot
 
/*
 * or use ES5 code (vue-waterfall.min.js) :
 * import { Waterfall, WaterfallSlot } from ‘vue-waterfall‘
 */
 
export default {
  ...
  components{
    Waterfall,
    WaterfallSlot
  },
  ...
}
 

ES5

var Vue require(‘vue)

var Waterfall require(‘vue-waterfall)
 
var YourComponent Vue.extend({
  ...
  components{
    ‘waterfallWaterfall.waterfall,
    ‘waterfall-slotWaterfall.waterfallSlot
  },
  ...
})
 

3、Browser

<script src="path/to/vue/vue.min.js"></script>

<script src="path/to/vue-waterfall/vue-waterfall.min.js"></script>
 
or
 
new Vue({
  ...
  components{
    ‘waterfallWaterfall.waterfall,
    ‘waterfall-slotWaterfall.waterfallSlot
  },
  ...
})
 
4、HTML structure
 
<waterfall :line-gap="200" :watch="items">
  <!-- each component is wrapped by a waterfall slot -->
  <waterfall-slot
    v-for="(item, index) in items"
    :width="item.width"
    :height="item.height"
    :order="index"
    :key="item.id"
  >
    <!--
      your component
    -->
  </waterfall-slot>
</waterfall>
 
5、Props

waterfall

namedefaultdescription
line v v or h . Line direction.
line-gap - Required. The standard space (px) between lines.
min-line-gap = line-gap The minimal space between lines.
max-line-gap = line-gap The maximal space between lines.
single-max-width = max-line-gap The maximal width of slot which is single in horizontal direction.
fixed-height false Fix slot height when line = v .
grow - Number Array. Slot flex grow factors in horizontal direction when line = v . Ignore *-gap .
align left left or right or center . Alignment.
auto-resize true Reflow when window size changes.
interval 200 The minimal time interval (ms) between reflow actions.
watch {} Watch something, reflow when it changes.

 

 

 

 

 

 

 

 

 

waterfall-slot

namedefaultdescription
width - Required. The width of slot.
height - Required. The height of slot.
order 0 The order of slot, often be set to index in v-for .
key ‘‘ The unique identification of slot, required for transition.
move-class - Class for transition. see vue-animated-list .

瀑布流vue-waterfall的高度设置

标签:limit   html   any   tran   tor   iter   meta   center   animate   

原文地址:https://www.cnblogs.com/liangzhixiaolaohu/p/8311475.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!