jd-opensource / jd-opensource/taro-ui
taro-ui 3.0.0-alpha.3 表单组件 AtForm 提交按钮点击后报错
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
### Taro UI 版本信息
v2.3.4
### 问题描述
表单组件 AtForm 提交按钮点击后报错。 使用 taro inti 命令安装时,选择 taro-ui,默认安装的 taro-ui 版本(3.0.0-alpha.3)
### 复现步骤
1. taro create --name test
2. 根据官网示例,完成代码文件 test.tsx,具体代码见下方
3. yarn dev:weapp
4. 微信开发者工具打开,点击表单提交按钮
### 复现代码
```
// test.tsx
import React, { Component } from 'react'
import { View, Text } from '@tarojs/components'
import { AtForm, AtInput, AtButton } from 'taro-ui'
import "taro-ui/dist/style/components/button.scss" // 按需引入
import './test.scss'
export default class Test extends Component {
constructor () {
super(...arguments)
this.state = {
value: ''
}
}
handleChange (value) {
this.setState({
value
})
}
onSubmit (event) {
console.log(this.state.value)
}
onReset (event) {
this.setState({
value: '',
})
}
render () {
return (
提交
重置
)
}
}
```
### 报错信息
```
MiniProgramError
Cannot read property 'triggerEvent' of undefined
TypeError: Cannot read property 'triggerEvent' of undefined
at AtButton.onSumit (http://127.0.0.1:26619/appservice/vendors.js:3051:21)
at TaroElement.dispatchEvent (http://127.0.0.1:26619/appservice/taro.js:4542:29)
at Ze.eventHandler [as eh] (http://127.0.0.1:26619/appservice/taro.js:2917:10)
at Object.r.safeCallback (http://127.0.0.1:26619/appservice/__dev__/WAService.js?t=wechat&v=2.12.2&s=1599558505684:2:1954289)
at http://127.0.0.1:26619/appservice/__dev__/WAService.js?t=wechat&v=2.12.2&s=1599558505684:2:2123485
at s (http://127.0.0.1:26619/appservice/__dev__/WAService.js?t=wechat&v=2.12.2&s=1599558505684:2:2050351)
at http://127.0.0.1:26619/appservice/__dev__/WAService.js?t=wechat&v=2.12.2&s=1599558505684:2:2123410
at r (http://127.0.0.1:26619/appservice/__dev__/WAService.js?t=wechat&v=2.12.2&s=1599558505684:2:2031780)
at http://127.0.0.1:26619/appservice/__dev__/WAService.js?t=wechat&v=2.12.2&s=1599558505684:2:2031902
at http://127.0.0.1:26619/appservice/__dev__/WAService.js?t=wechat&v=2.12.2&s=1599558505684:2:959048
console.error @ VM193:1
errorReport @ VM197 WAService.js:2
thirdErrorReport @ VM197 WAService.js:2
(anonymous) @ VM197 WAService.js:2
(anonymous) @ VM197 WAService.js:2
r.safeCallback @ VM197 WAService.js:2
r.call @ VM197 WAService.js:2
message @ VM197 WAService.js:2
r.safeCallback @ VM197 WAService.js:2
(anonymous) @ VM197 WAService.js:2
s @ VM197 WAService.js:2
(anonymous) @ VM197 WAService.js:2
r @ VM197 WAService.js:2
(anonymous) @ VM197 WAService.js:2
(anonymous) @ VM197 WAService.js:2
i @ VM16 asdebug.js:1
c @ VM16 asdebug.js:1
(anonymous) @ VM16 asdebug.js:1
p @ VM16 asdebug.js:1
g @ VM16 asdebug.js:1
(anonymous) @ VM16 asdebug.js:1
_ws.onmessage @ VM16 asdebug.js:1
```
### 系统信息
```
👽 Taro v3.0.9
Taro CLI 3.0.9 environment info:
System:
OS: macOS 10.15.5
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.13.1 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 3.0.9 => 3.0.9
@tarojs/components: 3.0.9 => 3.0.9
@tarojs/mini-runner: 3.0.9 => 3.0.9
@tarojs/react: 3.0.9 => 3.0.9
@tarojs/runtime: 3.0.9 => 3.0.9
@tarojs/taro: 3.0.9 => 3.0.9
@tarojs/webpack-runner: 3.0.9 => 3.0.9
babel-preset-taro: 3.0.9 => 3.0.9
eslint-config-taro: 3.0.9 => 3.0.9
react: ^16.10.0 => 16.13.1
taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.3
```
### 补充信息

Contributor guide
Assessment
This issue has not been assessed yet.