我有一个nuxt.js项目的问题.我使用异步组件,但当它rending时,async无法正常工作.这是我的代码.
我在https://nuxtjs.org/api/查看了文档,但我不知道究竟是什么问题
Test.vue(组件)
<template>
<div>
{{ project }}
</div>
</template>
<script>
export default {
data() {
return {
project : 'aaaa'
}
},
asyncData() {
return {
project : 'bbbb'
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是index.vue(页面)
<template>
<test></test>
</template>
<script>
import Test from '~/components/Test.vue'
export default {
components : {
Test
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
我的预期结果是
bbbb
但是当在http:// localhost:3000上运行时,这是实际结果
aaaa
我尝试多次搜索谷歌,但没有预期的解决方案.请帮助我的人.
谢谢你的帮助.