diff --git a/src/slider/README.md b/src/slider/README.md index b746be578..f425e6829 100644 --- a/src/slider/README.md +++ b/src/slider/README.md @@ -160,6 +160,7 @@ export default { | inactive-color | Inactive color of bar | _string_ | `#e5e5e5` | | range | Whether to enable dual thumb mode | _boolean_ | `false` | | disabled | Whether to disable slider | _boolean_ | `false` | +| readonly `v3.0.5` | Whether to be readonly | _boolean_ | `false` | | vertical | Whether to display slider vertically | _boolean_ | `false` | ### Events diff --git a/src/slider/README.zh-CN.md b/src/slider/README.zh-CN.md index c7adf9f5f..af42a9d12 100644 --- a/src/slider/README.zh-CN.md +++ b/src/slider/README.zh-CN.md @@ -166,6 +166,7 @@ export default { | inactive-color | 进度条非激活态颜色 | _string_ | `#e5e5e5` | | range | 是否开启双滑块模式 | _boolean_ | `false` | | disabled | 是否禁用滑块 | _boolean_ | `false` | +| readonly `v3.0.5` | 是否为只读状态 | _boolean_ | `false` | | vertical | 是否垂直展示 | _boolean_ | `false` | ### Events diff --git a/src/slider/index.tsx b/src/slider/index.tsx index 7c08d52b3..0988f5596 100644 --- a/src/slider/index.tsx +++ b/src/slider/index.tsx @@ -22,6 +22,7 @@ export default createComponent({ props: { range: Boolean, disabled: Boolean, + readonly: Boolean, vertical: Boolean, barHeight: [Number, String], buttonSize: [Number, String], @@ -134,7 +135,7 @@ export default createComponent({ const onClick = (event: MouseEvent) => { event.stopPropagation(); - if (props.disabled) { + if (props.disabled || props.readonly) { return; } @@ -161,7 +162,7 @@ export default createComponent({ }; const onTouchStart = (event: TouchEvent) => { - if (props.disabled) { + if (props.disabled || props.readonly) { return; } @@ -178,7 +179,7 @@ export default createComponent({ }; const onTouchMove = (event: TouchEvent) => { - if (props.disabled) { + if (props.disabled || props.readonly) { return; } @@ -205,7 +206,7 @@ export default createComponent({ }; const onTouchEnd = () => { - if (props.disabled) { + if (props.disabled || props.readonly) { return; } @@ -235,7 +236,7 @@ export default createComponent({