Skip to content

Commit b07543e

Browse files
committed
Merge branch 'HardlyMirage-master' #13
2 parents 6b6bf3a + c8dfe2d commit b07543e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## vue-virtual-scroll-list
1313

14-
> A vue (2.x) component support big data and infinite loading by using virtual scroll list.
14+
> A vue (2.x) component that supports big data and infinite loading by using virtual scroll list.
1515
1616
* Tiny and very easy to use.
1717

@@ -67,7 +67,7 @@ npm install vue-virtual-scroll-list --save
6767
</script>
6868
```
6969

70-
The `<Item>` component is included inside but defined outside the `<virtualList>` component. We see that `<virtualList>` **not** rely on `<Item>` component. So you can use virtual-list with any list item component freely.
70+
The `<Item>` component is included inside but defined outside the `<virtualList>` component. We see that `<virtualList>` does **not** rely on the `<Item>` component. So you can use virtual-list with any list item component freely.
7171

7272
#### Using by script tag:
7373

@@ -107,11 +107,13 @@ new Vue({
107107
*Prop* | *Type* | *Required* | *Description* |
108108
:--- | :--- | :--- | :--- |
109109
| size | Number || Each list item height, currently only supports fixed height. |
110-
| remain | Number || How many items except show in virtual-list viewport, so `size` and `remian` will determine the virtual-list outside container height (size × remian). |
111-
| start | Number | * | Default value is `0`, the initial scroll start index. It must be integer and in the range of list index, do nothing but throw a warnning if not match. |
110+
| remain | Number || How many items should be shown in virtual-list viewport, so `size` and `remain` will determine the virtual-list outside container height (size × remian). |
111+
| start | Number | * | Default value is `0`, the initial scroll start index. It must be integer and in the range of list index, throws a warning if index does not exist. |
112112
| rtag | String | * | Default value is `div`, the virtual-list's root HTMLElement tag name, in all case it's style is set to `display: block;` |
113+
| rclass | String | * | Default value is an empty string, the virtual-list's root HTMLElement tag's classes. Has the same API has [`v-bind:class`](https://vuejs.org/v2/guide/class-and-style.html) |
113114
| wtag | String | * | Default value is `div`, the virtual-list's item wrapper HTMLElement tag name, in all case it's style is set to `display: block;` |
114-
| onscroll | Function | * | Called when virtual-list scroll event hanlding, param: `(e, scrollTop)`. |
115+
| wclass | String | * | Default value is an empty string, the virtual-list's item wrapper HTMLElement tag's classes. Has the same API has [`v-bind:class`](https://vuejs.org/v2/guide/class-and-style.html) |
116+
| onscroll | Function | * | Called when virtual-list scroll event handling, param: `(e, scrollTop)`. |
115117
| totop | Function | * | Called when the virtual-list is scrolled to top. |
116118
| tobottom | Function | * | Called when the virtual-list is scrolled to bottom. |
117119

@@ -123,7 +125,7 @@ Welcome to improve vue-virtual-scroll-list by any pull request or issue.
123125

124126
## Changelogs
125127

126-
Maintain and update occasionally, changes see [releasese](https://github.com/tangbc/vue-virtual-scroll-list/releases).
128+
Maintain and update occasionally, for changes see [release](https://github.com/tangbc/vue-virtual-scroll-list/releases).
127129

128130
## License
129131

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
size: { type: Number, required: true },
2121
remain: { type: Number, required: true },
2222
rtag: { type: String, default: 'div' },
23+
rclass: { type: String, default: '' },
2324
wtag: { type: String, default: 'div' },
25+
wclass: { type: String, default: '' },
2426
start: { type: Number, default: 0 },
2527
totop: Function,
2628
tobottom: Function,
@@ -213,14 +215,16 @@
213215
},
214216
'on': {
215217
'scroll': this.handleScroll
216-
}
218+
},
219+
'class': this.rclass
217220
}, [
218221
createElement(this.wtag, {
219222
'style': {
220223
'display': 'block',
221224
'padding-top': delta.paddingTop + 'px',
222225
'padding-bottom': delta.allPadding - delta.paddingTop + 'px'
223-
}
226+
},
227+
'class': this.wclass
224228
}, showList)
225229
])
226230
}

0 commit comments

Comments
 (0)