Imagine there a object listed on data propery like this:
data(){
return {
fruit: {
grape: {
purpleGrape: {
price: '$5',
showPrice: () => { console.log(this.fruit.grape.purpleGrape.price) }
},
greenGrape: {
....
}
}
}
}
}
is that another way to simplify the showPrice function that use this.fruit.grape.purpleGrape.price to get the price instead ? I want to use this keyword that refers to the object it belongs to like :
showPrice: () => this.price
But it doesnt work, I just want to simplify this nested thingy → this.fruit.grape.purpleGrape.price