Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taro3.0.17 页面中有两个swiper时, 进入其他页面再返回, swiper报错 #8145

Closed
darkfiredarkhalo opened this issue Nov 27, 2020 · 5 comments
Labels
F-react Framework - React question Further information is requested T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@darkfiredarkhalo
Copy link

相关平台

微信小程序

小程序基础库: 2.14.0
使用框架: React

复现步骤

页面中写两个swiper, 然后进入子页面再返回, 滑动第一个swiper, 第一个swiper空白,第二个正常

期望结果

正常使用

实际结果

页面报错,第一个swiper空白,第二个正常信息如下:
TypeError: Cannot read property '$$' of undefined

环境信息

👽 Taro v3.0.3


  Taro CLI 3.0.3 environment info:
    System:
      OS: macOS 10.15.7
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.16.3 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.14.8 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 3.0.17 => 3.0.17 
      @tarojs/components: 3.0.17 => 3.0.17 
      @tarojs/mini-runner: 3.0.17 => 3.0.17 
      @tarojs/react: 3.0.17 => 3.0.17 
      @tarojs/runtime: 3.0.17 => 3.0.17 
      @tarojs/taro: 3.0.17 => 3.0.17 
      @tarojs/webpack-runner: 3.0.17 => 3.0.17 
      babel-preset-taro: 3.0.17 => 3.0.17 
      eslint-config-taro: 3.0.17 => 3.0.17 
      react: ^16.10.0 => 16.14.0 

补充信息

taro请以项目内版本为准

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Nov 27, 2020
@darkfiredarkhalo
Copy link
Author

补充信息如下:
1, 详细报错信息:


[渲染层错误] TypeError: Cannot read property '$$' of undefined
    at HTMLElement._attached.d._touchstartHandlerForDevtools (http://127.0.0.1:64072/__pageframe__/__dev__/WAWebview.js:2:1307014)
[渲染层错误] SystemError (webviewScriptError)
Cannot read property '$$' of undefined
TypeError: Cannot read property '$$' of undefined
    at HTMLElement._attached.d._touchstartHandlerForDevtools (http://127.0.0.1:64072/__pageframe__/__dev__/WAWebview.js:2:1307014)
[渲染层错误] Uncaught  

2, 截图:
swiper

@darkfiredarkhalo
Copy link
Author

使用的Hooks

@darkfiredarkhalo
Copy link
Author

经测试,是因为在swiperonChange事件中使用useState引起的。
因为自定义了swiper下边的指示器, 所以必须调用useStateset, 造成界面重新渲染, 然后就会报以上错误

@Chen-jj
Copy link
Contributor

Chen-jj commented Dec 21, 2020

从报错堆栈上看,是微信渲染层的错误。提供一个完整可复现的 demo 看看吧。

@Chen-jj Chen-jj added the question Further information is requested label Dec 21, 2020
@darkfiredarkhalo
Copy link
Author

非常感谢您的回复, 不过由于是沟通就可以解决的问题, 后边让修改了设计图, 不自定义指示器了, 所以问题就没有了.
刚单独写了示例, 也无法复现了, 可能和使用时的场景有关, 也可能与升级了taro版本到3.0.18有关, 非常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React question Further information is requested T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants