From b33fed911bcd3ca155f2ad3acfc58a35656363f5 Mon Sep 17 00:00:00 2001
From: kooriookami <38392315+kooriookami@users.noreply.github.com>
Date: Fri, 7 Jan 2022 15:44:43 +0800
Subject: [PATCH] feat(components): [el-slider] slider add size prop (#5091)
* feat: slider add size
* feat: update
* feat: update
* feat: update
---
docs/en-US/component/slider.md | 52 +++++----
docs/examples/slider/sizes.vue | 21 ++++
.../slider/__tests__/slider.spec.ts | 18 +++
packages/components/slider/src/index.vue | 57 +++++++---
packages/theme-chalk/src/common/var.scss | 1 -
packages/theme-chalk/src/slider.scss | 105 +++++-------------
6 files changed, 137 insertions(+), 117 deletions(-)
create mode 100644 docs/examples/slider/sizes.vue
diff --git a/docs/en-US/component/slider.md b/docs/en-US/component/slider.md
index ae46a83c36..7f539bde43 100644
--- a/docs/en-US/component/slider.md
+++ b/docs/en-US/component/slider.md
@@ -12,7 +12,7 @@ Drag the slider within a fixed range.
display: flex;
align-items: center;
.el-slider {
- flex: 1;
+ margin-top: 0;
margin-left: 12px;
}
.demonstration {
@@ -23,6 +23,7 @@ Drag the slider within a fixed range.
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ margin-bottom: 0;
& + .el-slider {
flex: 0 0 70%;
}
@@ -60,6 +61,14 @@ slider/slider-with-input-box
:::
+## Sizes
+
+:::demo
+
+slider/sizes
+
+:::
+
## Range selection
Selecting a range of values is supported.
@@ -88,26 +97,27 @@ slider/show-marks
## Attributes
-| Attribute | Description | Type | Accepted Values | Default |
-| --------------------- | --------------------------------------------------------------------------------------------------------- | --------------- | ---------------------- | ------- |
-| model-value / v-model | binding value | number | — | 0 |
-| min | minimum value | number | — | 0 |
-| max | maximum value | number | — | 100 |
-| disabled | whether Slider is disabled | boolean | — | false |
-| step | step size | number | — | 1 |
-| show-input | whether to display an input box, works when `range` is false | boolean | — | false |
-| show-input-controls | whether to display control buttons when `show-input` is true | boolean | — | true |
-| input-size | size of the input box | string | large / default /small | default |
-| show-stops | whether to display breakpoints | boolean | — | false |
-| show-tooltip | whether to display tooltip value | boolean | — | true |
-| format-tooltip | format to display tooltip value | function(value) | — | — |
-| range | whether to select a range | boolean | — | false |
-| vertical | vertical mode | boolean | — | false |
-| height | Slider height, required in vertical mode | string | — | — |
-| label | label for screen reader | string | — | — |
-| debounce | debounce delay when typing, in milliseconds, works when `show-input` is true | number | — | 300 |
-| tooltip-class | custom class name for the tooltip | string | — | — |
-| marks | marks, type of key must be `number` and must in closed interval `[min, max]`, each mark can custom style | object | — | — |
+| Attribute | Description | Type | Accepted Values | Default |
+| --------------------- | --------------------------------------------------------------------------------------------------------- | --------------- | ----------------------- | ------- |
+| model-value / v-model | binding value | number | — | 0 |
+| min | minimum value | number | — | 0 |
+| max | maximum value | number | — | 100 |
+| disabled | whether Slider is disabled | boolean | — | false |
+| step | step size | number | — | 1 |
+| show-input | whether to display an input box, works when `range` is false | boolean | — | false |
+| show-input-controls | whether to display control buttons when `show-input` is true | boolean | — | true |
+| size | size of the slider | string | large / default / small | default |
+| input-size | size of the input box, when set `size`, the default is the value of `size` | string | large / default / small | default |
+| show-stops | whether to display breakpoints | boolean | — | false |
+| show-tooltip | whether to display tooltip value | boolean | — | true |
+| format-tooltip | format to display tooltip value | function(value) | — | — |
+| range | whether to select a range | boolean | — | false |
+| vertical | vertical mode | boolean | — | false |
+| height | Slider height, required in vertical mode | string | — | — |
+| label | label for screen reader | string | — | — |
+| debounce | debounce delay when typing, in milliseconds, works when `show-input` is true | number | — | 300 |
+| tooltip-class | custom class name for the tooltip | string | — | — |
+| marks | marks, type of key must be `number` and must in closed interval `[min, max]`, each mark can custom style | object | — | — |
## Events
diff --git a/docs/examples/slider/sizes.vue b/docs/examples/slider/sizes.vue
new file mode 100644
index 0000000000..ecfd31705b
--- /dev/null
+++ b/docs/examples/slider/sizes.vue
@@ -0,0 +1,21 @@
+
+