How can I include a variable in a v-if statement based on my specific situation? I have a data variable called language = 'en'
and a large json object with data in multiple languages (referred to as message). Here is an example of the structure of the message json:
"message": {
"en": 1,
"es": 2
}
I would like the code to look something like this:
<span v-if="message.lang">some data</span>
When written like this, it functions properly:
<span v-if="message.en">some data</span>
However, when attempting to use a variable like so:
<span v-if="message[lang]">some data</span>
The above approach does not work as expected, preventing the use of the lang variable. Is there anyone who can assist me with this issue?