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

4.0.7 react webpack支付宝小程序View无法触发onClick #16812

Closed
yamlling opened this issue Nov 5, 2024 · 1 comment
Closed

4.0.7 react webpack支付宝小程序View无法触发onClick #16812

yamlling opened this issue Nov 5, 2024 · 1 comment
Assignees
Labels
F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-4 Version - 4.x
Milestone

Comments

@yamlling
Copy link

yamlling commented Nov 5, 2024

相关平台

支付宝小程序

复现仓库

https://gitee.com/yamlling_admin/taro-react-taroui.git
小程序基础库: 2.9.30
使用框架: React

复现步骤

逻辑代码
`
const login = () => {

if (!checked) {
  showToast({
    title: '请先同意用户协议',
    icon: 'none',
    duration: 2000
  })
  return
}
if (!mobile) {
  showToast({
    title: '请输入手机号码',
    icon: 'none',
    duration: 2000
  })
  return
}

if (login_type === '短信登录') {
  if (!checkCode) {
    showToast({
      title: '请输入验证码',
      icon: 'none',
      duration: 2000
    })
    return
  }
}
if (login_type === '账号登录') {
  if (!password) {
    showToast({
      title: '请输入密码',
      icon: 'none',
      duration: 2000
    })
    return
  }

  // 检测密码只能为数字和英文字母
  let reg = /^[A-Za-z0-9]+$/
  if (!reg.test(password)) {
    showToast({
      title: '密码只能为数字和英文字母',
      icon: 'none',
      duration: 2000
    })
  }
}


mobileLogin({
  mobile,
  checkCode,
  password,
  loginType: login_type === '短信登录' ? 2 : 1,
  custLoginName: mobile,
})
  .then(async res => {
    await product_car_info({
      size: 10,
      current: 1
    }).then(res => {
      let num = res.data.total
      dispatch('car', { type: 'SET_CAR', payload: { num: num } })
    });
    reLaunch({
      url: '/pages/login-result/index'
    })
  })
  .catch(err => {
    if (err.msg == '业务异常: 会员密码不正确,请重新登录或选用其他方式登录') {
      showToast({
        title: '账号密码错误',
        icon: 'error',
        duration: 2000
      })
    } else {
      showToast({
        title: err.msg,
        icon: 'error',
        duration: 2000
      })
    }
  })

}
`

模板代码
<View className="btn mt-[42px] mb-[54px] flex justify-center items-center bg-def color-black" onClick={login} > 登录 </View>

期望结果

能正常触发点击事件

实际结果

无法触发点击事件

环境信息

👽 Taro v4.0.7


  Taro CLI 4.0.7 environment info:
    System:
      OS: Windows 11 10.0.26100
    Binaries:
      Node: 18.20.4 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
      npm: 10.7.0 - 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-platform-alipay: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-h5: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-harmony-hybrid: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-jd: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-qq: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-swan: 4.0.7 => 4.0.7
      @tarojs/plugin-platform-tt: 4.0.7 => 4.0.7
      @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/taro-loader: 4.0.7 => 4.0.7
      @tarojs/webpack5-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

补充信息

Button组件能正常触发点击事件

@TheKonka TheKonka added F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-4 Version - 4.x labels Nov 5, 2024
@yamlling
Copy link
Author

yamlling commented Nov 5, 2024

尝试过后发现Text Button 等组件都能正常出发onClick 唯独常规容器View不可以

@tutuxxx tutuxxx self-assigned this Nov 7, 2024
@tutuxxx tutuxxx added this to the 4.0.8 milestone Nov 7, 2024
This was referenced Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-alipay Target - 编译到支付宝小程序 V-4 Version - 4.x
Projects
None yet
Development

No branches or pull requests

3 participants