@@ -12,6 +12,9 @@ import classNames from '../_util/classNames';
12
12
import { useInjectFormItemContext } from '../form/FormItemContext' ;
13
13
import type { FocusEventHandler } from '../_util/EventInterface' ;
14
14
15
+ // CSSINJS
16
+ import useStyle from './style' ;
17
+
15
18
export type SliderValue = number | [ number , number ] ;
16
19
17
20
interface SliderMarks {
@@ -87,6 +90,10 @@ const Slider = defineComponent({
87
90
setup ( props , { attrs, slots, emit, expose } ) {
88
91
const { prefixCls, rootPrefixCls, direction, getPopupContainer, configProvider } =
89
92
useConfigInject ( 'slider' , props ) ;
93
+
94
+ // style
95
+ const [ wrapSSR , hashId ] = useStyle ( prefixCls ) ;
96
+
90
97
const formItemContext = useInjectFormItemContext ( ) ;
91
98
const sliderRef = ref ( ) ;
92
99
const visibles = ref < Visibles > ( { } ) ;
@@ -156,9 +163,13 @@ const Slider = defineComponent({
156
163
...restProps
157
164
} = props ;
158
165
const tooltipPrefixCls = configProvider . getPrefixCls ( 'tooltip' , customizeTooltipPrefixCls ) ;
159
- const cls = classNames ( attrs . class , {
160
- [ `${ prefixCls . value } -rtl` ] : direction . value === 'rtl' ,
161
- } ) ;
166
+ const cls = classNames (
167
+ attrs . class ,
168
+ {
169
+ [ `${ prefixCls . value } -rtl` ] : direction . value === 'rtl' ,
170
+ } ,
171
+ hashId . value ,
172
+ ) ;
162
173
163
174
// make reverse default on rtl direction
164
175
if ( direction . value === 'rtl' && ! restProps . vertical ) {
@@ -172,8 +183,9 @@ const Slider = defineComponent({
172
183
}
173
184
174
185
if ( range ) {
175
- return (
186
+ return wrapSSR (
176
187
< VcRange
188
+ { ...attrs }
177
189
{ ...restProps }
178
190
step = { restProps . step ! }
179
191
draggableTrack = { draggableTrack }
@@ -190,11 +202,12 @@ const Slider = defineComponent({
190
202
onChange = { handleChange }
191
203
onBlur = { handleBlur }
192
204
v-slots = { { mark : slots . mark } }
193
- />
205
+ /> ,
194
206
) ;
195
207
}
196
- return (
208
+ return wrapSSR (
197
209
< VcSlider
210
+ { ...attrs }
198
211
{ ...restProps }
199
212
id = { id }
200
213
step = { restProps . step ! }
@@ -211,7 +224,7 @@ const Slider = defineComponent({
211
224
onChange = { handleChange }
212
225
onBlur = { handleBlur }
213
226
v-slots = { { mark : slots . mark } }
214
- />
227
+ /> ,
215
228
) ;
216
229
} ;
217
230
} ,
0 commit comments