3***@qq.com
3***@qq.com
  • 发布:2021-04-14 11:40
  • 更新:2021-04-14 13:13
  • 阅读:315

【报Bug】transitionTap中调用接口,接口中修改变量值为false,在transitionTap中下次调用还是true

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.1.9

浏览器平台: Chrome

浏览器版本: 74.0.3729.157

项目创建方式: HBuilderX

示例代码:

transitionTap中调用接口,接口中修改变量值为false,在transitionTap中判断是否为false。

操作步骤:

transitionTap中调用接口,接口中修改变量值为false,在transitionTap中判断是否为false。

预期结果:

transitionTap中调用接口,接口中修改变量值为false,在transitionTap中判断是否为false。

实际结果:

transitionTap中调用接口,接口中修改变量值为false,在transitionTap中判断是否为false。

bug描述:

在transition中设置isLoad = true ,后面调接口后恢复为false,打印后结果的确是false。继续操作滑动位置时发现提示isload为true被return(if (that.isLoad === true) {) 这部分,我在animationfinish也打印isload 明明显示为false。难道transition中调用接口后修改变量为false是没有效果?但是在animationfinish中打印是正确修改了啊

            transitionTap: function(options) {  
                console.log(1)  
                var dx = options.detail.dx;  
                var action = dx > 40 ? 2 : (dx < -40 ? 1 : 0);  
                if (action === 0) {  
                    console.log('1111',dx)  
                    return;  
                }  
                if (that.isLoad === true) {  
                    console.log('2222',that.isLoad)  
                    return;  
                }  
                let canLoad = (that.swiperCurrent == 0) || ( that.swiperCurrent == that.listData.length - 1);  
                if (!canLoad) {  
                    console.log('3333')  
                    return;  
                }  
                //console.log(that.swiperCurrent,that.listData.length,that.currentPage)  
                //console.log(action == 2 ? '右' : '左')  
                if (action === 1 && that.currentPage == 1) {  
                    console.log('4444')  
                    return;  
                }  
                if(action===2 && that.swiperCurrent !== that.listData.length - 1)  
                {  
                    console.log('5555')  
                    return;  
                }     

                //todo(最大page)  
                if (action == 2 && that.currentPage == 180) {  
                    console.log('6666')  
                    return;  
                }  

                that.isLoad = true;  
                // todo  左滑动current=max  否则为0  
                that.currentPage = action === 1 ? that.currentPage-1 : that.currentPage+1;  
                that.getQuestion(action);  
            },  
            animationfinishTap: function(options) {  
                if ("touch" == options.detail.source) {  
                    console.log(2)  
                    let current = options.detail.current;  
                    let canLoad = (that.swiperCurrent == 0) || ( that.swiperCurrent == that.listData.length - 1);  
                    if (canLoad) {  
                        //that.loadMore = canLoad  
                    }  
                    that.swiperCurrent = current;  
                    that.refreshSomething();  
                }  
            },
2021-04-14 11:40 负责人:无 分享
已邀请:
3***@qq.com

3***@qq.com (作者)

官方不维护了吗

该问题目前已经被锁定, 无法添加新回复