Skip to content

Commit

Permalink
fix: props virtualHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
lfb committed Feb 14, 2023
1 parent 3f53c38 commit 2ff52ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Vue.use(liteVirtualList)
| screen | Array | [ 1 , 1 ]| | The number of screens rendered before and after the viewable area. The default value is `[1,1]`, rendering one screen before and one screen after the viewable area. Example: `screen = [2,3]` means that two screens are rendered in front of the viewable area and three screens are rendered behind the viewable area. |
| distance | Number \| String |50| | The distance to trigger the `loadmore` callback when the page scrolls. The default is `50` |
| interval | Number \| String | 0| | `Scroll` event trigger interval, default is `0` |
| virtualHieght | String | 100%| | The height of the virtual list is' 100% 'by default. When the type is `fixed`, the height will be calculated dynamically according to the `size` and `remain` attributes. This value is not required to be passed in. When the type is `variable` or `waterfall`, if this property is not passed in, the external container must declare a height value. |
| virtualHeight | String | 100%| | The height of the virtual list is' 100% 'by default. When the type is `fixed`, the height will be calculated dynamically according to the `size` and `remain` attributes. This value is not required to be passed in. When the type is `variable` or `waterfall`, if this property is not passed in, the external container must declare a height value. |
| unit | String | px | | Unit, default is `PX` |
| deleteId | Number \| String | | | When dynamically deleting an item, the ID value of the current item needs to be passed in. When the type is `fixed`, the deletion ID is not passed in, and the current item is deleted directly `this.data.splice (index, 1)`delete is OK. At this time, the high value will be calculated dynamically
| marginBottom | Number \| String | 0 | | The distance between items. This property is provided only when type is `waterfall`. It is invalid when type is `fixed` or `variable` |
Expand Down
8 changes: 4 additions & 4 deletions src/lib/virtual-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
required: false,
default: 0,
},
virtualHieght: {
virtualHeight: {
type: String,
required: false,
default: '100%',
Expand Down Expand Up @@ -206,12 +206,12 @@ export default {
break
case virtualType.VARIABLE:
this.variableData = []
this.$refs.virtualList.style.height = this.virtualHieght
this.$refs.virtualList.style.height = this.virtualHeight
this.variableData = this.getVisiblePosition(this.data)
break
case virtualType.WATERFALL:
// 必须设置scrollList高度否则scrollList的高度会被 容器内容撑起造成高度与virtualList不同 则会出现滚动条偏移问题
this.$refs.virtualList.style.height = this.$refs.scrollList.style.height = this.virtualHieght
this.$refs.virtualList.style.height = this.$refs.scrollList.style.height = this.virtualHeight
this.leftEnd = this.leftStart + this.remain
this.rightEnd = this.rightStart + this.remain
if (this.data && this.data.length) {
Expand Down Expand Up @@ -433,4 +433,4 @@ export default {
.right-item {
overflow: hidden;
}
</style>
</style>

0 comments on commit 2ff52ca

Please sign in to comment.