
# vue-waterfall
[](https://travis-ci.org/MopTym/vue-waterfall)
[](https://www.npmjs.com/package/vue-waterfall)
[](LICENSE)
A waterfall layout component for Vue.js .
Branch [0.x (version 0.x.x)](https://github.com/MopTym/vue-waterfall/tree/0.x) is compatible with Vue 1 .
## Demo
- [Vertical line](http://app.moptym.com/vue-waterfall/demo/vertical-line.html)
- [Horizontal line](http://app.moptym.com/vue-waterfall/demo/horizontal-line.html)
- [Vertical line with grow](http://app.moptym.com/vue-waterfall/demo/vertical-line-with-grow.html)
## Installation
```shell
npm install --save vue-waterfall
```
## Usage
Vue-waterfall is a [UMD](https://github.com/umdjs/umd) module, which can be used as a module in both CommonJS and AMD modular environments. When in non-modular environment, `Waterfall` will be registered as a global variable.
### Import
#### ES6
```js
/* 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
```js
var Vue = require('vue')
var Waterfall = require('vue-waterfall')
var YourComponent = Vue.extend({
...
components: {
'waterfall': Waterfall.waterfall,
'waterfall-slot': Waterfall.waterfallSlot
},
...
})
```
#### Browser
```html
<script src="path/to/vue/vue.min.js"></script>
<script src="path/to/vue-waterfall/vue-waterfall.min.js"></script>
```
```js
new Vue({
...
components: {
'waterfall': Waterfall.waterfall,
'waterfall-slot': Waterfall.waterfallSlot
},
...
})
```
### HTML structure
```html
<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>
```
## Props
### waterfall
<table>
<thead>
<tr>
<th width="160">Name</th>
<th width="160">Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>line</td>
<td><code>v</code></td>
<td><code>v</code> or <code>h</code> . Line direction.</td>
</tr>
<tr>
<td>line-gap</td>
<td>-</td>
<td>Required. The standard space (px) between lines.</td>
</tr>
<tr>
<td>min-line-gap</td>
<td>= line-gap</td>
<td>The minimal space between lines.</td>
</tr>
<tr>
<td>max-line-gap</td>
<td>= line-gap</td>
<td>The maximal space between lines.</td>
</tr>
<tr>
<td>single-max-width</td>
<td>= max-line-gap</td>
<td>The maximal width of slot which is single in horizontal direction.</td>
</tr>
<tr>
<td>fixed-height</td>
<td><code>false</code></td>
<td>Fix slot height when line = <code>v</code> .</td>
</tr>
<tr>
<td>grow</td>
<td>-</td>
<td>Number Array. Slot flex grow factors in horizontal direction when line = <code>v</code> . Ignore <code>*-gap</code> .</td>
</tr>
<tr>
<td>align</td>
<td><code>left</code></td>
<td><code>left</code> or <code>right</code> or <code>center</code> . Alignment.</td>
</tr>
<tr>
<td>auto-resize</td>
<td><code>true</code></td>
<td>Reflow when window size changes.</td>
</tr>
<tr>
<td>interval</td>
<td><code>200</code></td>
<td>The minimal time interval (ms) between reflow actions.</td>
</tr>
<tr>
<td>watch</td>
<td><code>{}</code></td>
<td>Watch something, reflow when it changes.</td>
</tr>
</tbody>
</table>
### waterfall-slot
<table>
<thead>
<tr>
<th width="160">Name</th>
<th width="160">Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>width</td>
<td>-</td>
<td>Required. The width of slot.</td>
</tr>
<tr>
<td>height</td>
<td>-</td>
<td>Required. The height of slot.</td>
</tr>
<tr>
<td>order</td>
<td><code>0</code></td>
<td>The order of slot, often be set to <code>index</code> in <code>v-for</code> .</td>
</tr>
<tr>
<td>key</td>
<td><code>''</code></td>
<td>The unique identification of slot, required for transition.</td>
</tr>
<tr>
<td>move-class</td>
<td>-</td>
<td>Class for transition. see <a href="https://github.com/vuejs/vue-animated-list" target="_blank">vue-animated-list</a> .</td>
</tr>
</tbody>
</table>
## Transition
Inspired by [vue-animated-list](https://github.com/vuejs/vue-animated-list) , vue-waterfall supports moving elements with `translate` in transition, click on the [demo](http://app.moptym.com/vue-waterfall/demo/vertical-line.html) page to see it.
vue-waterfall has not supported `<transition-group>` in Vue 2 ( [#10](https://github.com/MopTym/vue-waterfall/issues/10) ) .

## Events
```js
ON ( 'reflow' ) {
reflow
}
// trigger reflow action: waterfallVm.$emit('reflow')
```
```js
AFTER ( reflow ) {
emit 'reflowed'
}
// waterfallVm.$on('reflowed', () => { console.log('reflowed') })
```
## Reactivity
```js
WHEN ( layout property changes ) { /* line, line-gap, etc. */
reflow
}
```
```js
WHEN ( slot changes ) { /* add, remove, etc. */
reflow
}
```
## License
Released under the [MIT](LICENSE) License.
没有合适的资源?快使用搜索试试~ 我知道了~
Vue.js 的瀑布布局组件.zip

共23个文件
js:5个
vue:4个
html:3个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 169 浏览量
2024-12-01
09:51:26
上传
评论
收藏 373KB ZIP 举报
温馨提示
Vue.js 的瀑布布局组件vue-瀑布 Vue.js 的瀑布布局组件。分支0.x (版本 0.xx)与 Vue 1 兼容。演示垂线水平线带生长的垂直线安装npm install --save vue-waterfall用法Vue-waterfall 是一个UMD模块,在 CommonJS 和 AMD 模块化环境中均可作为模块使用。在非模块化环境中,Waterfall将被注册为全局变量。进口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 { ... component
资源推荐
资源详情
资源评论






























收起资源包目录































共 23 条
- 1
资源评论


赵闪闪168
- 粉丝: 1746
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 学生信息管理数据库设计研究报告.doc
- 大数据时代档案管理工作如何与时俱进.docx
- 物联网工程专业计算机组成原理教学改革探索.docx
- 软件工程专业本科实践教学改革研究.docx
- 校园监控系统设计方案(本地监控和网络集中管理结合).doc
- 鼎利微博FTP功能操作指导.ppt
- 数控编程实验指导说明书(修改).doc
- 现代中庆网络化多媒体教室建设方案3110DG-L.doc
- 新工科背景下通信原理教学研究.docx
- 大数据与机器学习构建动态企业级画像系统.docx
- 浅述机电设各安装工程项目管理.docx
- 这篇文章详细探讨了基于属性偏序原理的属性偏序结构图表示算法,涵盖了从理论基础到具体实现的多个方面(论文复现含详细代码及解释)
- 数据库系统在计算机体系结构中的应用.docx
- 云南水电厂技术监督评价大刚(自动化).doc
- 基于计算机视觉技术的细胞检测模型研究与应用
- 【机械臂控制】基于事件触发的复合阻抗控制方法设计与仿真:提高机械臂力位跟踪精度及通信资源利用率(论文复现含详细代码及解释)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
