1
i18nのワイフローでNuxtJSにデータを表示するのは困難です。Nuxt.js + vue-i18n + axios:ページ内のデータへのアクセスができません
<template>
<div class="Content">
<div class="container">
<ul>
<li v-for="post in posts">
{{ $t('post.title') }}
</li>
</ul>
</div>
</div>
</template>
<script>
export default {
data:() => ({
posts: []
})
}
</script>
あなたが持っているでした:blog.vue>
プラグイン>は
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import axios from 'axios'
Vue.use(VueI18n, axios)
export default ({ app, store }) => {
// Set i18n instance on app
// This way we can use it in middleware and pages asyncData/fetch
app.i18n = new VueI18n({
locale: store.state.locale,
fallbackLocale: 'en',
messages: {
'en': axios({
method: 'get',
url: 'https://jsonplaceholder.typicode.com/posts'
}).then((res) => { return { posts: res.data } }),
'fr': 'hello'
}
})
}
ページ版のi18n.js:
は、ここで私は確かにコンフィギュレーションで何かを逃し、二つのファイルです問題のアイデア?