Skip to content

Commit a948c5c

Browse files
committed
refactor: 优化逻辑
1 parent 7dfee7f commit a948c5c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/packages/video/video.taro.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ const defaultProps = {
1919
},
2020
} as TaroVideoProps
2121

22-
const classPrefix = `nut-video`
22+
const classPrefix = 'nut-video'
23+
2324
export const Video: FunctionComponent<Partial<TaroVideoProps & VideoProps>> = (
2425
props
2526
) => {
@@ -39,8 +40,12 @@ export const Video: FunctionComponent<Partial<TaroVideoProps & VideoProps>> = (
3940
onPlayEnd,
4041
...restProps
4142
} = mergeProps(defaultProps, props)
43+
4244
const classes = classNames(classPrefix, className)
4345

46+
const effectiveControls =
47+
props.options?.controls ?? controls ?? options.controls
48+
4449
return (
4550
<View className={classes} style={style}>
4651
<VideoTaro
@@ -49,7 +54,7 @@ export const Video: FunctionComponent<Partial<TaroVideoProps & VideoProps>> = (
4954
autoplay={options.autoplay || autoplay}
5055
loop={options.loop || loop}
5156
poster={options.poster || poster}
52-
controls={controls !== undefined ? controls : options.controls}
57+
controls={effectiveControls}
5358
src={source.src || (src as string)}
5459
onPlay={onPlay}
5560
onPause={onPause}

0 commit comments

Comments
 (0)