in the data function I have created tomorrow variable with the date of today then I have set it by appenden 1 day to it but I'm getting this error
data(){
return{
tomorrow: new Date(),
tomorrow.setDate(tomorrow.getDate() 1),
};
},
error Parsing error: Unexpected token .
CodePudding user response:
The data property is design for storing variables, not invoking functions or adding logic like you're trying to do.
Try computed property:
computed: {
tomorrow() {
const d = new Date()
d.setDate(d.getDate() 1)
return d
}
}
And then in your template you can do {{ tomorrow }}
or in your vue component this.tomorrow