12345678910111213141516171819202122232425262728293031 |
- const BindingX = uni.requireNativePlugin('bindingx')
- import { os } from '../../libs/function/index';
- export default {
- methods: {
-
- nvueScrollHandler(e) {
- const anchor = this.$refs['u-scroll-list__scroll-view'].ref
- let element = {}
- if (this.$refs['u-scroll-list__indicator__line__bar']) {
- 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 = os() === 'ios' ? 2 : 1
- const expression = `(x / ${actionNum}) / ${contentSize - scrollWidth} * ${barAllMoveWidth}`
- BindingX.bind({
- anchor,
- eventType: 'scroll',
- props: [{
- element,
- property: 'transform.translateX',
- expression
- }]
- })
- }
- }
- }
|