Skip to content

Commit

Permalink
fix(components): code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Jan 27, 2020
1 parent ad902f6 commit 97aaaa5
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions packages/taro-components/src/components/scroll-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,18 @@ class ScrollView extends Nerv.Component {
scrollHeight,
scrollWidth
} = this.container
const detail = {
scrollLeft,
scrollTop,
scrollHeight,
scrollWidth
}
try {
this._scrollLeft = scrollLeft
this._scrollTop = scrollTop
Object.assign(e, { detail })
} catch (error) {
Object.defineProperty(e, 'detail', {
writable: true
})
Object.assign(e, { detail })
// console.error(error)
}
this._scrollLeft = scrollLeft
this._scrollTop = scrollTop
Object.defineProperty(e, 'detail', {
enumerable: true,
writable: true,
value: {
scrollLeft,
scrollTop,
scrollHeight,
scrollWidth
}
})
uperAndLowerThrottle()
onScroll && onScroll(e)
}
Expand Down

0 comments on commit 97aaaa5

Please sign in to comment.