-
zhangwei
2024-08-29 447e19fa298ae11a1c3a3fa2d2ff3a1a8dba0501
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 本文件由FirstUI授权予四川政采招投标咨询有限公司(会员ID: 1 63,营业执照号:9 15  1 0   13    1332 0 0 6 1 93 K)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
// #ifdef APP-NVUE
const BindingX = uni.requireNativePlugin('bindingx');
export default {
    methods: {
        getEl(el) {
            return this.$refs[el] ? this.$refs[el].ref : null;
        },
        nvueScrollHandler(e) {
            const anchor = this.getEl('fui_scroller_view')
            const element = this.getEl('fui_hor_indicator')
            if (!anchor || !element) return;
            const scrollLeft = e.contentOffset.x
            const contentWidth = e.contentSize.width
            if (this.scroll && element) {
                const barAllMoveWidth = this.bgWidth - this.blockWidth
                const platform = uni.getSystemInfoSync().platform
                const actionNum = platform.toLowerCase() === 'ios' ? 2 : 1
                const expression = `(x / ${actionNum}) / ${contentWidth - this.width} * ${barAllMoveWidth}`
                BindingX.bind({
                    anchor,
                    eventType: 'scroll',
                    props: [{
                        element,
                        property: 'transform.translateX',
                        expression
                    }]
                })
            }
            if (scrollLeft + this.width === contentWidth) {
                this.scrollEvent('right')
            } else if (scrollLeft === 0) {
                this.scrollEvent('left')
            }
        }
    }
}
 
// #endif
 
// #ifndef APP-NVUE
export default {}
// #endif