Skip to content

<TypeError: null is not an object (evaluating 'router.$taroPath')> #18028

@Leeanderth

Description

@Leeanderth

请先确认

  • 我已搜索并确定这个提交不是重复的

Taro 版本

v4

相关平台

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 头条小程序
  • QQ 小程序
  • 钉钉小程序
  • 飞书小程序
  • 快手小程序

小程序基础库版本

No response

使用框架

React

问题描述

使用Taro.previewImage || Taro.openCustomerServiceChat后,回到原页面报错router.$taroPath

复现链接

xxx

复现步骤

使用 Taro.previewImage({
urls: previewUrls,
showmenu: false,
current: currentIndex >= 0 ? previewUrls[currentIndex] : previewUrls[0],
success: () => {
console.log('success')
},
fail: () => {
console.log('fail')
}
})

当关闭预览图片的页面后,原页面内容无法点击,控制台报错
<TypeError: null is not an object (evaluating 'router.$taroPath')>
RootPortal@https://usr//appservice.app.js:7403:163089
Re@https://usr//appservice.app.js:7401:201209
bi@https://usr//appservice.app.js:7401:256489
ai@https://usr//appservice.app.js:7401:241227
@https://usr//appservice.app.js:7401:241094
Qh@https://usr//appservice.app.js:7401:241099
Vh@https://usr//appservice.app.js:7401:237856
Oh@https://usr//appservice.app.js:7401:236402
Oh@[native code]
J2@https://usr//appservice.app.js:7401:170441
R2@https://usr//appservice.app.js:7401:170987
f@https://lib/WASubContext.js:1:152270
@https://lib/WASubContext.js:1:116886
@https://lib/WASubContext.js:1:147602
p@https://lib/WAServiceMainContext.js:1:158405
@https://lib/WAServiceMainContext.js:1:149426
_onNativeTimer@
global code@

环境信息

👽 Taro v4.0.7


  Taro CLI 4.0.7 environment info:
    System:
      OS: Windows 11 10.0.26100
    Binaries:
      Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
      npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 4.0.7 => 4.0.7 
      @tarojs/components: 4.0.7 => 4.0.7 
      @tarojs/helper: 4.0.7 => 4.0.7 
      @tarojs/plugin-framework-react: 4.0.7 => 4.0.7 
      @tarojs/plugin-html: ^4.0.7 => 4.0.8 
      @tarojs/plugin-platform-weapp: 4.0.7 => 4.0.7 
      @tarojs/react: 4.0.7 => 4.0.7 
      @tarojs/runtime: 4.0.7 => 4.0.7 
      @tarojs/shared: 4.0.7 => 4.0.7 
      @tarojs/taro: 4.0.7 => 4.0.7 
      @tarojs/vite-runner: 4.0.7 => 4.0.7 
      babel-preset-taro: 4.0.7 => 4.0.7 
      eslint-config-taro: 4.0.7 => 4.0.7 
      react: ^18.0.0 => 18.3.1

贡献代码

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-reactFramework - ReactT-weappTarget - 编译到微信小程序V-4Version - 4.xbugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions