Issue
So lets say I want to add this {{ $t('index-p1') }}
inside the value of title
.
items: [
{
icon: 'mdi-apps',
title: 'Welcome',
to: '/'
},
I am using this for i18n and the data that the {{ $t('index-p1') }}
contains is stored in a JSON file. It works just fine if I use it in a Vue template file, but not in data, I don't remember how to do this part.
Solution
items
should be defined as computed property, and access $t
using this
:
computed:{
items(){
return [
{
icon: 'mdi-apps',
title: this.$t('welcome'),
to: '/'
}
]
}
}
Answered By - Boussadjra Brahim Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.