I have a component that is going to have data named isVendorOrAgent that should be false or true based on a property that the component gets. When I put this condition on the data section of the component, it doesn't work and always returns false but when I put that in created() and change the isVendorOrAgent in created(), it works.
How can I make this work?
This is the condition that is not working:
data : () => {
return {
isVendorOrAgent : (this.entityName == "vendor" || this.entityName == "agent") ? true : false;
}
}
but this works when the default is false:
created(){
if(this.entityName == "vendor" || this.entityName == "agent"){
this.isVendorOrAgent = true;
}
}