File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
- import type { ExtractPropTypes , VNode } from 'vue' ;
1
+ import { ExtractPropTypes , VNode , watch } from 'vue' ;
2
2
import { defineComponent , ref , reactive , onMounted } from 'vue' ;
3
3
import { initDefaultProps , getPropsSlot , findDOMNode } from '../_util/props-util' ;
4
4
import { withInstall } from '../_util/type' ;
@@ -53,7 +53,12 @@ const Rate = defineComponent({
53
53
cleanedValue : null ,
54
54
hoverValue : undefined ,
55
55
} ) ;
56
-
56
+ watch (
57
+ ( ) => props . value ,
58
+ ( ) => {
59
+ state . value = props . value ;
60
+ } ,
61
+ ) ;
57
62
const getStarDOM = ( index : number ) => {
58
63
return findDOMNode ( starRefs . value [ index ] ) ;
59
64
} ;
@@ -73,7 +78,9 @@ const Rate = defineComponent({
73
78
return value ;
74
79
} ;
75
80
const changeValue = ( value : number ) => {
76
- state . value = value ;
81
+ if ( props . value === undefined ) {
82
+ state . value = value ;
83
+ }
77
84
emit ( 'update:value' , value ) ;
78
85
emit ( 'change' , value ) ;
79
86
} ;
You can’t perform that action at this time.
0 commit comments