Skip to content

taro-ui AtButton formType='submit' 微信小程序下不能触发事件 #1270

Open
@xiaof520

Description

@xiaof520

版本信息:
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
            });
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions