Answer the question
In order to leave comments, you need to log in
How to correctly use class instances as data parameter values in vue.js?
There is a class:
class User {
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
get fullName() {
return this.firstName + ' ' + this.lastName;
}
getFullName() {
return this.firstName + ' ' + this.lastName;
}
}
export default {
data: () => ({
user: new User('Иван', 'Иванов')
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question