uni-app 使用switchTab切换页面 方法调用成功但页面没有跳转

uni-app 使用switchTab切换页面 方法调用成功但页面没有跳转

开发环境 版本号 项目创建方式
Windows 21H2 22000.282 HBuilderX

产品分类:uniapp/小程序/QQ


操作步骤:

  • 点击按钮

预期结果:

  • 跳转到对应页面

实际结果:

  • 方法调用成功,页面没有跳转

bug描述:

在home页面点击按钮按钮调用uni.switchTab,方法调用成功,但页面没有进行跳转。在开发者工具里不生效,真机测试没问题。 调用结果:调用成功 {errMsg: “switchTab:ok”}

<template>  
    <button @click="test">  
        test  
    </button>  
</template>  

<script>  
    export default{  
        methods:{  
            test(){  
                uni.switchTab({  
                    url:'/pages/main/index/index',  
                    success(res) {  
                        console.log('调用成功',res);  
                    }  
                })  
            }  
        }  
    }  
</script>

以下为pages.json配置代码。

"tabBar": {  
    "color": "#909399",  
    "selectedColor": "#303133",  
    "backgroundColor": "#FFFFFF",  
    "borderStyle": "black",  
    "list": [{  
        "text": "角色",  
        "pagePath": "pages/main/index/index",  
        "iconPath": "",  
        "selectedIconPath": ""  
    },  {  
        "text": "我的",  
        "pagePath": "pages/main/home/home",  
        "iconPath": "",  
        "selectedIconPath": ""  
    }]  
}

更多关于uni-app 使用switchTab切换页面 方法调用成功但页面没有跳转的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于uni-app 使用switchTab切换页面 方法调用成功但页面没有跳转的实战教程也可以访问 https://www.itying.com/category-93-b0.html


这是QQ开发者工具的bug,0.3.1测试正常,0.3.4有这个问题

回到顶部