12345678910111213141516171819202122232425262728 |
- const BindingX = uni.requireNativePlugin('bindingx')
- export default {
- methods: {
-
- nvueScrollHandler(e) {
- const anchor = this.$refs['u-scroll-list__scroll-view'].ref
- const element = this.$refs['u-scroll-list__indicator__line__bar'].ref
- const scrollLeft = e.contentOffset.x
- const contentSize = e.contentSize.width
- const { scrollWidth } = this
- const barAllMoveWidth = this.indicatorWidth - this.indicatorBarWidth
-
- const actionNum = uni.$u.os() === 'ios' ? 2 : 1
- const expression = `(x / ${actionNum}) / ${contentSize - scrollWidth} * ${barAllMoveWidth}`
- BindingX.bind({
- anchor,
- eventType: 'scroll',
- props: [{
- element,
- property: 'transform.translateX',
- expression
- }]
- })
- }
- }
- }
|