@@ -12,10 +12,13 @@ import useConfigInject from '../config-provider/hooks/useConfigInject';
1212import devWarning from '../vc-util/devWarning' ;
1313import { progressProps , progressStatuses } from './props' ;
1414import type { VueNode } from '../_util/type' ;
15+ import useStyle from './style' ;
16+ import classNames from '../_util/classNames' ;
1517
1618export default defineComponent ( {
1719 compatConfig : { MODE : 3 } ,
1820 name : 'AProgress' ,
21+ inheritAttrs : false ,
1922 props : initDefaultProps ( progressProps ( ) , {
2023 type : 'line' ,
2124 percent : 0 ,
@@ -26,8 +29,9 @@ export default defineComponent({
2629 strokeLinecap : 'round' ,
2730 } ) ,
2831 slots : [ 'format' ] ,
29- setup ( props , { slots } ) {
32+ setup ( props , { slots, attrs } ) {
3033 const { prefixCls, direction } = useConfigInject ( 'progress' , props ) ;
34+ const [ wrapSSR , hashId ] = useStyle ( prefixCls ) ;
3135 devWarning (
3236 props . successPercent == undefined ,
3337 'Progress' ,
@@ -37,6 +41,7 @@ export default defineComponent({
3741 const { type, showInfo, size } = props ;
3842 const pre = prefixCls . value ;
3943 return {
44+ [ hashId . value ] : true ,
4045 [ pre ] : true ,
4146 [ `${ pre } -${ ( type === 'dashboard' && 'circle' ) || type } ` ] : true ,
4247 [ `${ pre } -show-info` ] : showInfo ,
@@ -93,6 +98,7 @@ export default defineComponent({
9398
9499 return ( ) => {
95100 const { type, steps, strokeColor, title } = props ;
101+ const { class : cls , ...restAttrs } = attrs ;
96102 const progressInfo = renderProcessInfo ( ) ;
97103
98104 let progress : VueNode ;
@@ -120,15 +126,14 @@ export default defineComponent({
120126 ) ;
121127 }
122128
123- const classNames = {
124- ...classString . value ,
129+ const classes = classNames ( classString . value , {
125130 [ `${ prefixCls . value } -status-${ progressStatus . value } ` ] : true ,
126- } ;
131+ } ) ;
127132
128- return (
129- < div class = { classNames } title = { title } >
133+ return wrapSSR (
134+ < div { ... restAttrs } class = { [ classes , cls ] } title = { title } >
130135 { progress }
131- </ div >
136+ </ div > ,
132137 ) ;
133138 } ;
134139 } ,
0 commit comments