diff --git a/CHINESE-README.md b/CHINESE-README.md index 7d5136a..46db3a5 100644 --- a/CHINESE-README.md +++ b/CHINESE-README.md @@ -67,7 +67,7 @@ this.$waterfall.forceUpdate() //forceUpdate ## Usage 注意: - 1. `gutterWidth`需要与`width`一起使用才会生效,否则会进行自适应宽度(使用rem布局时,需先计算出自适应后的宽度再传值) + 1. 使用`rem`布局时,需先计算出自适应后的宽度再传值 2. 使用了`waterfall`的父组件,如果样式存在问题,可去掉css `scoped`尝试一下 ##### main.js ```javascript @@ -105,7 +105,7 @@ Vue.use(waterfall) /* 注意: - 1. gutterWidth需要与width一起使用才会生效,否则会进行自适应宽度(使用rem布局时,需先计算出自适应后的宽度再传值) + 1. 使用`rem`布局时,需先计算出自适应后的宽度再传值 2. 使用了`waterfall`的父组件,如果样式存在问题,可去掉css `scoped`尝试一下 */ diff --git a/ENGLISH-README.md b/ENGLISH-README.md index 26da1c0..28dde57 100644 --- a/ENGLISH-README.md +++ b/ENGLISH-README.md @@ -1,20 +1,27 @@ + +#### [中文版文档](https://github.com/AwesomeDevin/vue-waterfall2/blob/master/CHINESE-README.md) # vue-waterfall2 1. auto adaption for width and height 2. High degree of customization - 3. support lazy load(attribute with `lazy-src`) + 3. Swipe to the bottom to trigger on pc/android, pull up to trigger on ios + 4. Support lazy load(attribute with `lazy-src`) + 5. Easy to use, for PC/ios/android ![The demo on mobile device](https://raw.githubusercontent.com/AwesomeDevin/vue-waterfall2/master/src/assets/gifhome_240x514_17s.gif) -## [中文版文档](https://github.com/AwesomeDevin/vue-waterfall2/blob/master/CHINESE-README.md) If you have some questions,welcome to describe issues、suggestions;Thank you for your Star ! [Welcome to my blog !!!](https://github.com/AwesomeDevin/blog) ## Demo -[Demo](http://47.105.188.15:3001/index.html) +[Common Demo](http://47.105.188.15:3001/) +[Lazyload Demo](http://47.105.188.15:3001/#/list) +[Code Demo](https://codesandbox.io/embed/vue-template-99ps6) + + @@ -29,16 +36,50 @@ npm run dev npm i vue-waterfall2@latest --save ``` +## Props +Name | Default | Type | Desc +-------- | -------- | -------- | -------- +height | null | Number | height of container +col | 2 | Number | The number of column +width | null | Number | The width of each column +gutterWidth | 10 | Number | The value of margin +data | [] | Array | data +isTransition | true | Boolean | load image with transition +lazyDistance | 300 | Number | The distance of image lazy loading +loadDistance | 300 | Number | The distance of loadmore + +## Lazy Load +For images that need to be loaded lazily, the 'lazy-src' attribute needs to be used +```html + + + +``` + +## Events +Name | Data | Desc +-------- | --- | -------- +loadmore | - | Scroll to the bottom to trigger on PC / pull up to trigger on Mobile +scroll | obj | Scroll to trigger and get the infomation of scroll +finish | - | finish render + +## $waterfall API +``` +this.$waterfall.forceUpdate() //forceUpdate +``` + ## Usage Notes: - 1. attribute `gutterWidth` needs to be used together with `width` to be effective, otherwise it will be adaptive width (when using `rem` to layout, calculate the width after adaptation before passing the value). + 1. when using `rem` to layout, calculate the width after adaptation before passing the value. 2. Use the parent component of 'waterfall' if there is a problem with the style, remove CSS `scoped` and try it ##### main.js ```javascript import waterfall from 'vue-waterfall2' Vue.use(waterfall) ``` -##### app.vue(Scoped is not used for this component style) +##### app.vue ```javascript