NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/

Home Page:https://docs.taro.zone/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

View组件获取dataset为空

mrold opened this issue · comments

commented

相关平台

字节跳动小程序

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

复现步骤

只要包含了子组件,那么获取到的dateset为{}

 <View data-test="test" onClick={e => console.log(e.target.dataset)}>
    <Text>test</Text>
 </View>

期望结果

获取的dataset的值

实际结果

空值

环境信息

👽 Taro v3.6.30


  Taro CLI 3.6.30 environment info:
    System:
      OS: macOS 14.1.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
      npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.30 => 3.6.30
      @tarojs/components: 3.6.30 => 3.6.30
      @tarojs/helper: 3.6.30 => 3.6.30
      @tarojs/plugin-framework-react: 3.6.30 => 3.6.30
      @tarojs/plugin-html: 3.6.30 => 3.6.30
      @tarojs/plugin-platform-alipay: 3.6.30 => 3.6.30
      @tarojs/plugin-platform-h5: 3.6.30 => 3.6.30
      @tarojs/plugin-platform-jd: 3.6.30 => 3.6.30
      @tarojs/plugin-platform-qq: 3.6.30 => 3.6.30
      @tarojs/plugin-platform-swan: 3.6.30 => 3.6.30
      @tarojs/plugin-platform-tt: 3.6.30 => 3.6.30
      @tarojs/plugin-platform-weapp: 3.6.30 => 3.6.30
      @tarojs/react: 3.6.30 => 3.6.30
      @tarojs/runtime: 3.6.30 => 3.6.30
      @tarojs/shared: 3.6.30 => 3.6.30
      @tarojs/taro: 3.6.30 => 3.6.30
      @tarojs/taro-loader: 3.6.30 => 3.6.30
      @tarojs/webpack5-runner: 3.6.30 => 3.6.30
      babel-preset-taro: 3.6.30 => 3.6.30
      eslint-config-taro: 3.6.30 => 3.6.30
      react: ^18.0.0 => 18.3.1

react不推荐这样用,使用高阶函数传递参数