Skip to content

Commit 829595e

Browse files
authored
fix(#1270) : 解决 AtButton formType='submit' 微信小程序下不能触发事件 #1270 (#1533)
1 parent 35d8427 commit 829595e

File tree

1 file changed

+2
-33
lines changed
  • packages/taro-ui/src/components/button

1 file changed

+2
-33
lines changed

packages/taro-ui/src/components/button/index.tsx

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from 'classnames'
22
import PropTypes, { InferProps } from 'prop-types'
33
import React from 'react'
4-
import { Button, Form, View } from '@tarojs/components'
4+
import { Button, View } from '@tarojs/components'
55
import { ButtonProps } from '@tarojs/components/types/Button'
66
import { BaseEventOrig, CommonEvent } from '@tarojs/components/types/common'
77
import Taro from '@tarojs/taro'
@@ -62,30 +62,6 @@ export default class AtButton extends React.Component<
6262
this.props.onOpenSetting && this.props.onOpenSetting(event)
6363
}
6464

65-
private onSumit(event: CommonEvent): void {
66-
if (this.state.isWEAPP || this.state.isWEB) {
67-
// TODO: 3.0 this.$scope
68-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
69-
// @ts-ignore
70-
this.$scope.triggerEvent('submit', event.detail, {
71-
bubbles: true,
72-
composed: true
73-
})
74-
}
75-
}
76-
77-
private onReset(event: CommonEvent): void {
78-
if (this.state.isWEAPP || this.state.isWEB) {
79-
// TODO: 3.0 this.$scope
80-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
81-
// @ts-ignore
82-
this.$scope.triggerEvent('reset', event.detail, {
83-
bubbles: true,
84-
composed: true
85-
})
86-
}
87-
}
88-
8965
public render(): JSX.Element {
9066
const {
9167
size = 'normal',
@@ -162,14 +138,7 @@ export default class AtButton extends React.Component<
162138
onClick={this.onClick.bind(this)}
163139
>
164140
{isWEB && !disabled && webButton}
165-
{isWEAPP && !disabled && (
166-
<Form
167-
onSubmit={this.onSumit.bind(this)}
168-
onReset={this.onReset.bind(this)}
169-
>
170-
{button}
171-
</Form>
172-
)}
141+
{isWEAPP && !disabled && button}
173142
{isALIPAY && !disabled && button}
174143
{loadingComponent}
175144
<View className='at-button__text'>{this.props.children}</View>

0 commit comments

Comments
 (0)