WIP Добавила даты в стор
This commit is contained in:
@@ -63,8 +63,9 @@
|
||||
|
||||
<script>
|
||||
import BaseInput from "@/components/base/BaseInput";
|
||||
import * as moment from "moment/moment";
|
||||
//import * as moment from "moment/moment";
|
||||
import BaseCalendar from "@/components/base/BaseCalendar";
|
||||
import { mapState, mapActions } from "vuex";
|
||||
export default {
|
||||
name: "CalendarHeader",
|
||||
components: { BaseInput, BaseCalendar },
|
||||
@@ -82,8 +83,8 @@ export default {
|
||||
},
|
||||
],
|
||||
date: {
|
||||
from: moment(),
|
||||
to: moment().clone().add(6, "day"),
|
||||
from: null,
|
||||
to: null,
|
||||
},
|
||||
calendarVisibility: false,
|
||||
};
|
||||
@@ -94,6 +95,12 @@ export default {
|
||||
"D MMMM YYYY"
|
||||
)} - ${this.date?.to?.format("D MMMM YYYY")}`;
|
||||
},
|
||||
...mapState({
|
||||
selectedDates: (state) => state.calendar.selectedDates,
|
||||
}),
|
||||
...mapActions({
|
||||
changeSelectedDates: "changeSelectedDates",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
previousWeek() {
|
||||
@@ -105,6 +112,32 @@ export default {
|
||||
this.date.to = this.date.to.clone().add(1, "week");
|
||||
},
|
||||
},
|
||||
/*watch: {
|
||||
selectedDates: {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
handler(val) {
|
||||
console.log("в сторе", val);
|
||||
},
|
||||
},
|
||||
date: {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
handler(val) {
|
||||
console.log("в компоненте", val);
|
||||
},
|
||||
},
|
||||
calendarVisibility(val) {
|
||||
console.log(val, this.changeSelectedDates);
|
||||
if (val === false) this.changeSelectedDates(this.date);
|
||||
},
|
||||
},*/
|
||||
mounted() {
|
||||
this.date = {
|
||||
from: this.selectedDates.from.clone(),
|
||||
to: this.selectedDates.to.clone(),
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user