File tree Expand file tree Collapse file tree
src/components/DatetimePicker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,22 +76,24 @@ export default {
7676
7777 methods: {
7878 handleSelectYear (year ) {
79- if (this .value ) {
79+ const value = this .$refs .datepicker .currentValue
80+ if (value) {
8081 try {
81- const value = new Date (new Date (this . value ).setFullYear (year))
82- this .$refs .datepicker .selectDate (value )
82+ const date = new Date (new Date (value).setFullYear (year))
83+ this .$refs .datepicker .selectDate (date )
8384 } catch (error) {
84- console .error (' Invalid value' , this . value , year)
85+ console .error (' Invalid value' , value, year)
8586 }
8687 }
8788 },
8889 handleSelectMonth (month ) {
89- if (this .value ) {
90+ const value = this .$refs .datepicker .currentValue
91+ if (value) {
9092 try {
91- const value = new Date (new Date (this . value ).setMonth (month))
92- this .$refs .datepicker .selectDate (value )
93+ const date = new Date (new Date (value).setMonth (month))
94+ this .$refs .datepicker .selectDate (date )
9395 } catch (error) {
94- console .error (' Invalid value' , this . value , month)
96+ console .error (' Invalid value' , value, month)
9597 }
9698 }
9799 }
You can’t perform that action at this time.
0 commit comments