Skip to content

Commit ecb47df

Browse files
authored
fix(switch): 简化props使用 (#3132)
1 parent d6f1f6e commit ecb47df

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/packages/switch/switch.taro.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ export const Switch: FunctionComponent<Partial<TaroSwitchProps>> = (props) => {
6060

6161
const onClick = () => {
6262
if (disabled || changing) return
63-
if (props.onChange) {
63+
if (onChange) {
6464
setChanging(true)
65-
props.onChange(!value)
65+
onChange(!value)
6666
}
6767
setValue(!value)
6868
}

src/packages/switch/switch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export const Switch: FunctionComponent<Partial<WebSwitchProps>> = (props) => {
5858

5959
const onClick = () => {
6060
if (disabled || changing) return
61-
if (props.onChange) {
61+
if (onChange) {
6262
setChanging(true)
63-
props.onChange(!value)
63+
onChange(!value)
6464
}
6565
setValue(!value)
6666
}

0 commit comments

Comments
 (0)