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-ui AtButton formType='submit' 微信小程序下不能触发事件 #1270

Open
xiaof520 opened this issue Jan 4, 2021 · 5 comments
Open

Comments

@xiaof520
Copy link

xiaof520 commented Jan 4, 2021

版本信息:
Taro-ui 3.0.0-alpha.8
Taro v3.0.21

Taro CLI 3.0.21 environment info:
System:
OS: Windows 10
Binaries:
Node: 14.15.1 - D:\nodejs\node.EXE
npm: 6.14.10 - D:\nodejs\npm.CMD

微信小程序错误信息:
VM1335 WAService.js:2 TypeError: Cannot read property 'triggerEvent' of undefined
at AtButton.onSumit (vendors.js:8490)
at TaroElement.eventHandler (vendors.js:3075)
at TaroElement.dispatchEvent (element.ts:170)
at ge.eventHandler [as eh] (event.ts:100)
at Object.n.safeCallback (VM1335 WAService.js:2)
at VM1335 WAService.js:2
at a (VM1335 WAService.js:2)
at VM1335 WAService.js:2
at n (VM1335 WAService.js:2)
at VM1335 WAService.js:2

错误部分:

    onSumit(event) {
        if (this.state.isWEAPP || this.state.isWEB) {
            // TODO: 3.0 this.$scope
            // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
            // @ts-ignore
            this.$scope.triggerEvent('submit', event.detail, {
                bubbles: true,
                composed: true
            });
        }
    }
@taro-ui-bot
Copy link

taro-ui-bot bot commented Jan 4, 2021

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@PreacherJing
Copy link

同样的问题

@xiaof520
Copy link
Author

xiaof520 commented Jan 22, 2021

同样的问题

后来直接改用taro button组件,修复前别用taro ui里的这些组件

@MengChuilu
Copy link

直接用demo的就会复现这个bug

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@UphkcRNqmafQWcSSSSSS
Copy link

改源码,

{isWEAPP && !disabled && (
  <Form
    onSubmit={this.onSumit.bind(this)}
    onReset={this.onReset.bind(this)}
  >
    {button}
  </Form>
)}
// 改成
{isWEAPP && !disabled && (
  {button}
)}

或者不用使用AtForm,直接使用taro的form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants