uni-app transitionTap中调用接口,接口中修改变量值为false,但在transitionTap中下次调用该变量值仍为true

uni-app transitionTap中调用接口,接口中修改变量值为false,但在transitionTap中下次调用该变量值仍为true

示例代码:

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();  
    }  
},
信息 描述
产品分类 uniapp/H5
PC开发环境操作系统 Windows
PC开发环境版本 win10
HBuilderX类型 正式
HBuilderX版本号 3.1.9
浏览器平台 Chrome
浏览器版本 74.0.3729.157
项目创建方式 HBuilderX

更多关于uni-app transitionTap中调用接口,接口中修改变量值为false,但在transitionTap中下次调用该变量值仍为true的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于uni-app transitionTap中调用接口,接口中修改变量值为false,但在transitionTap中下次调用该变量值仍为true的实战教程也可以访问 https://www.itying.com/category-93-b0.html


官方不维护了吗

回到顶部