运行到微信小程序就报错routeDone with a webviewId 39 that is not the current page
运行到微信小程序就报错routeDone with a webviewId 39 that is not the current page
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
Windows | win11 | HBuilderX |
4.61 | ||
1.06.2412050 | ||
3.7.12 |
产品分类:uniapp/小程序/微信
PC开发环境操作系统:Windows
HBuilderX类型:正式
第三方开发者工具版本号:1.06.2412050
基础库版本号:3.7.12
示例代码:
routeDone with a webviewId 39 that is not the current page(env: Windows,mp,1.06.2412050; lib: 3.7.12)
(anonymous) @ index.esm.js:361
操作步骤:
routeDone with a webviewId 39 that is not the current page(env: Windows,mp,1.06.2412050; lib: 3.7.12)
(anonymous) @ index.esm.js:361
预期结果:
routeDone with a webviewId 39 that is not the current page(env: Windows,mp,1.06.2412050; lib: 3.7.12)
(anonymous) @ index.esm.js:361
实际结果:
routeDone with a webviewId 39 that is not the current page(env: Windows,mp,1.06.2412050; lib: 3.7.12)
(anonymous) @ index.esm.js:361
bug描述:
routeDone with a webviewId 39 that is not the current page(env: Windows,mp,1.06.2412050; lib: 3.7.12)
(anonymous) @ index.esm.js:361
3 回复
提供下复现工程。看报错是来自微信小程序的。你可以对比你周围同事是否会这样。真机是否正常
你是不是也升级了微信开发者工具版本
这个错误通常是由于微信小程序页面路由切换时的时序问题导致的。以下是可能的原因和解决方案:
-
最常见的原因是页面切换时,前一个页面的某些异步操作还未完成就跳转到了新页面。可以检查是否有未完成的网络请求或定时器。
-
检查项目中是否使用了自定义导航栏或自定义了路由行为,这可能会干扰微信小程序的默认路由机制。
-
尝试升级微信开发者工具到最新版本,有时这是微信开发者工具的已知bug。
-
检查页面生命周期钩子函数(如onLoad、onShow等)中是否有耗时操作,确保它们不会阻塞页面切换。
-
如果是使用uni.navigateTo等API跳转页面,可以尝试添加setTimeout延迟跳转:
setTimeout(() => {
uni.navigateTo({
url: '/pages/xxx/xxx'
})
}, 50)