1***@qq.com
1***@qq.com
  • 发布:2022-11-01 12:17
  • 更新:2022-11-01 12:17
  • 阅读:168

【报Bug】uni中打包app正式包后switchtab切换不到指定tabbar页面

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: Alpha

HBuilderX版本号: 3.6.8

手机系统: Android

手机系统版本号: Android 11

手机厂商: 华为

手机机型: X8

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

//首页index页面script代码
img_click(){
console.log('被点击')
uni.switchTab({
url:'/pages/tabbar/shouye/shouye'
})
}

//tabbar中pages/tabbar/shouye/shouye页面代码
onLaunch() {
console.log('launch')
uni.showToast({
title:'launch'
})
},
onLoad() {
console.log('load')
uni.showToast({
title:'load'
})
},
onShow() {
console.log('show')
uni.showToast({
title:'show'
})
},

//toast输出:只有show

操作步骤:

“”“
<template>
<view class="content">
<image class="logo" src="/static/logo.png" @click="img_click"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
</view>
</template>

<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {

    },  
    methods: {  
        img_click(){  
            console.log('被点击')  
            uni.showToast({  
                title:"被点击"  
            })  
            uni.switchTab({  
                url:'/pages/tabview/shouye/shouye'  
            })  
        }  
    }  
}  

</script>

<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.logo {  
    height: 200rpx;  
    width: 200rpx;  
    margin-top: 200rpx;  
    margin-left: auto;  
    margin-right: auto;  
    margin-bottom: 50rpx;  
}  

.text-area {  
    display: flex;  
    justify-content: center;  
}  

.title {  
    font-size: 36rpx;  
    color: #8f8f94;  
}  

</style>
”“”
“”“
<template>
<view>

</view>  

</template>

<script>
export default {
data() {
return {

        }  
    },  
    onLaunch() {  
        console.log('onLaunch')  
        uni.showToast({  
            title:"onLaunch"  
        })  
    },  
    onLoad() {  
        console.log('onLoad')  
        uni.showToast({  
            title:"onLoad"  
        })  
    },  
    onShow() {  
        console.log('onShow')  
        uni.showToast({  
            title:"onShow"  
        })  
    },  
    methods: {  

    }  
}  

</script>

<style>

</style>
”“”

预期结果:

“”
onLaunch
onLoad
onShow
“”

实际结果:

“”
onShow
“”

bug描述:

app打正式包(云打包),打包完成后,switchtab无法切换到指定页面或者或切换后的页面不显示,但是会执行新页面的onshow,onload方法,恒奇怪,

2022-11-01 12:17 负责人:无 分享
已邀请:

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