Skip to content

Commit

Permalink
fix(h5): 适配组件库 loading 错误显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Feb 21, 2024
1 parent 7cae45d commit 01a25cd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/taro-components-react/src/components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@ interface IProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'ty
type?: string
className?: string
}

interface IState {
hover:boolean
touch: boolean
}

class Button extends React.Component<IProps, IState> {

constructor (props) {
super(props)
this.state = {
hover: false,
touch: false
}
}
startTimer
endTimer

startTimer: ReturnType<typeof setTimeout>
endTimer: ReturnType<typeof setTimeout>

componentWillUnmount () {
this.startTimer && clearTimeout(this.startTimer)
Expand Down Expand Up @@ -108,7 +107,7 @@ class Button extends React.Component<IProps, IState> {
loading={loading.toString()}
plain={plain.toString()}
>
{loading && <i className='weui-loading' />}
{!!loading && <i className='weui-loading' />}
{children}
</button>
)
Expand Down

0 comments on commit 01a25cd

Please sign in to comment.