File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 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' ;
22import { defineComponent , ref , reactive , onMounted } from 'vue' ;
33import { initDefaultProps , getPropsSlot , findDOMNode } from '../_util/props-util' ;
44import { withInstall } from '../_util/type' ;
@@ -53,7 +53,12 @@ const Rate = defineComponent({
5353 cleanedValue : null ,
5454 hoverValue : undefined ,
5555 } ) ;
56-
56+ watch (
57+ ( ) => props . value ,
58+ ( ) => {
59+ state . value = props . value ;
60+ } ,
61+ ) ;
5762 const getStarDOM = ( index : number ) => {
5863 return findDOMNode ( starRefs . value [ index ] ) ;
5964 } ;
@@ -73,7 +78,9 @@ const Rate = defineComponent({
7378 return value ;
7479 } ;
7580 const changeValue = ( value : number ) => {
76- state . value = value ;
81+ if ( props . value === undefined ) {
82+ state . value = value ;
83+ }
7784 emit ( 'update:value' , value ) ;
7885 emit ( 'change' , value ) ;
7986 } ;
You can’t perform that action at this time.
0 commit comments