6***@qq.com
6***@qq.com
  • 发布:2025-11-10 17:04
  • 更新:2025-11-10 17:04
  • 阅读:14

【报Bug】在APP端使用plus.screen.lockOrientation切换横竖屏后,快速多次点击导航栏的返回按钮,APP会偶尔出现闪退现象

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 4.76

手机系统: Android

手机系统版本号: Android 11

手机厂商: 华为

手机机型: HUAWEI P20 Pro

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

1.创建usePageOrientation.ts文件

export function usePageOrientation() {  
  const lockLandscape = () => {  
    // #ifdef APP-PLUS  
    plus.screen.lockOrientation('landscape-primary')  
    // #endif  
  }  

  const restorePortrait = () => {  
    // #ifdef APP-PLUS  
    plus.screen.lockOrientation('portrait-primary')  
    // #endif  
  }  

  return {  
    lockLandscape,  
    restorePortrait,  
  }  
}

2.在a页面引入onShow中执行restorePortrait

import { usePageOrientation } from '@/hooks/usePageOrientation'  
const { lockLandscape, restorePortrait } = usePageOrientation()  
onShow(() => {  
  restorePortrait()  
})

3.从a页面跳转到b页面,页面设置为横屏

import { usePageOrientation } from '@/hooks/usePageOrientation'  
const { lockLandscape, restorePortrait } = usePageOrientation()  
onLoad((options: any) => {  
  lockLandscape()  
})

4.从b页面返回a页面,然后快速点击返回按钮,应用偶尔会闪退

预期结果:

直接返回上一级

实际结果:

应用偶尔会闪退

bug描述:

从横屏页面切换到竖屏页面,然后快速多次点击导航栏返回按钮,应用偶尔会闪退。

2025-11-10 17:04 负责人:无 分享
已邀请:

要回复问题请先登录注册