[new feature] Button: add touchstart event (#3039)

This commit is contained in:
neverland
2019-03-22 14:41:01 +08:00
committed by GitHub
parent 2a4c2d86e9
commit 5a44d204bd
7 changed files with 46 additions and 23 deletions
+24 -17
View File
@@ -46,28 +46,35 @@ function Button(
}
};
const onTouchstart = (event: TouchEvent) => {
emit(ctx, 'touchstart', event);
};
const classes = [
bem([
type,
props.size,
{
loading,
disabled,
hairline,
block: props.block,
plain: props.plain,
round: props.round,
square: props.square,
'bottom-action': props.bottomAction
}
]),
{ 'van-hairline--surround': hairline }
];
return (
<tag
class={classes}
type={props.nativeType}
disabled={disabled}
class={[
bem([
type,
props.size,
{
loading,
disabled,
hairline,
block: props.block,
plain: props.plain,
round: props.round,
square: props.square,
'bottom-action': props.bottomAction
}
]),
{ 'van-hairline--surround': hairline }
]}
onClick={onClick}
onTouchstart={onTouchstart}
{...inherit(ctx)}
>
{loading ? (