Skip to content

Commit 2ed47bc

Browse files
committed
Update and add test cover.
1 parent 3d16a0b commit 2ed47bc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(function (root, factory) {
22
var namespace = 'VirtualScrollList'
3+
/* istanbul ignore next */
34
if (typeof exports === 'object' && typeof module === 'object') {
45
module.exports = factory(namespace, require('vue'))
56
} else if (typeof define === 'function' && define.amd) {
@@ -10,10 +11,12 @@
1011
root[namespace] = factory(namespace, root['Vue'])
1112
}
1213
})(this, function (namespace, Vue2) {
14+
/* istanbul ignore next */
1315
if (typeof Vue2 === 'object' && typeof Vue2.default === 'function') {
1416
Vue2 = Vue2.default
1517
}
1618

19+
/* istanbul ignore next */
1720
var _debounce = function (func, wait, immediate) {
1821
var timeout
1922
return function () {
@@ -101,7 +104,7 @@
101104
onScroll: function (e) {
102105
var delta = this.delta
103106
var vsl = this.$refs.vsl
104-
var offset = (vsl && (vsl instanceof Vue2 ? vsl.$el : vsl).scrollTop) || 0
107+
var offset = (vsl.$el || vsl).scrollTop || 0
105108

106109
if (delta.total > delta.keeps) {
107110
this.updateZone(offset)
@@ -319,7 +322,7 @@
319322
setScrollTop: function (scrollTop) {
320323
var vsl = this.$refs.vsl
321324
if (vsl) {
322-
(vsl instanceof Vue2 ? vsl.$el : vsl).scrollTop = scrollTop
325+
(vsl.$el || vsl).scrollTop = scrollTop
323326
}
324327
},
325328

0 commit comments

Comments
 (0)