我想设置一个名为“ dates:”的prop的值,该值位于另一个名为“ attributes:”的prop-parent中。我找不到日期:因为它在prop属性数组中:并且因此我无法在created()方法中设置日期的值。如何获得道具“ dates”并更改其值?
export default {
name: "Vacations",
data() {
return {
vacantDays: '5',
isActive: false,
vacDates: null,
occupiedDays: [new Date("03 January 2019")],
attr:
[
{
highlight: {
backgroundColor: '#ff8080', // Red background
borderColor: '#ff6666',
borderWidth: '2px',
borderStyle: 'solid',
},
contentStyle: {
color: 'white', // White text
},
dates: [5],
},
]
}
},
created() {
this.$acl.change(localStorage.getItem('user'));
let name = localStorage.getItem('username');
instance.get("/calendar/occupied",{
params: {
name: name
}
}).then(res => {
console.log(res.data);
let datesArray = res.data.map(dateString => new Date(dateString));
console.log(datesArray);
//this.attr.dates=datesArray;
console.log(this.attr.get(dates));
}).catch(err=> {
console.log(err);
});
},
}