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

Taro引入第三方组件时转义后的事件名称为全小写,导致无法触发对应的事件 #7177

Closed
luxiaojie322 opened this issue Jul 27, 2020 · 8 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@luxiaojie322
Copy link

相关平台

微信小程序

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

复现步骤

对微信小程序第三方组件绑定事件,命名用驼峰的方式,在微信开发者工具可看到被转义为全小写的字符串

期望结果

当我使用驼峰命名的方式时转义后也为驼峰

实际结果

转义后为全小写

环境信息

Taro CLI 3.0.5 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.18.1 - /usr/local/bin/node
      npm: 6.14.5 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.5 => 3.0.5 
      @tarojs/mini-runner: 3.0.5 => 3.0.5 
      @tarojs/react: 3.0.5 => 3.0.5 
      @tarojs/runtime: 3.0.5 => 3.0.5 
      @tarojs/taro: 3.0.5 => 3.0.5 
      @tarojs/webpack-runner: 3.0.5 => 3.0.5 
      babel-preset-taro: 3.0.5 => 3.0.5 
      eslint-config-taro: 3.0.5 => 3.0.5 
      react: ^16.10.0 => 16.13.1 
      taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.3 
    npmGlobalPackages:
      typescript: 3.9.7
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 27, 2020
@luxiaojie322
Copy link
Author

image
image

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 30, 2020

@luxiaojie322 提供个 demo 看看吧。

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 30, 2020

编译成全小写是正确的,微信的监听事件规则就是全小写:https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html#%E8%A7%A6%E5%8F%91%E4%BA%8B%E4%BB%B6

@luxiaojie322
Copy link
Author

有一些微信小程序的第三方组件事件的属性名为驼峰的方式,导致无法触发相对于的方法,我现在的做法是直接修改组件源代码内的属性名为全小写来与之对应
image

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 31, 2020

提供个 demo 看看吧。

@airmount
Copy link

airmount commented Jan 8, 2021

@Chen-jj 想问一下这个问题是怎么解决的~~

@GQ-sunshine
Copy link

@Chen-jj 这个问题什么时候能修复呢?

@shichaohui
Copy link

@Chen-jj 请问这个问题怎么解决?只能修改源码的事件名吗?

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

No branches or pull requests

5 participants