Skip to content

Commit

Permalink
add example for computed property for locales
Browse files Browse the repository at this point in the history
  • Loading branch information
tikiatua committed Jan 26, 2018
1 parent 5a33547 commit 0d3f3ac
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ <h2>Available locales</h2>
{{ locale }}
</li>
</ul>
<hr>
<p>With computed propery:</p>
<ul>
<li v-for="locale in locales">
{{ locale }}
</li>
</ul>
</div>

<template v-if="$i18n.locale() == 'en'">
Expand Down Expand Up @@ -347,6 +354,11 @@ <h2>Load missing translations asynchronously</h2>
this.$i18n.set('fr');
this.$i18n.add('fr', localeFr);
}
},
computed: {
locales() {
return Object.keys(this.$store.state.i18n.translations);
}
}
});

Expand Down

0 comments on commit 0d3f3ac

Please sign in to comment.