Javascript 尝试使用Vue输出WordPress post数据时出现问题

Javascript 尝试使用Vue输出WordPress post数据时出现问题,javascript,wordpress,vue.js,Javascript,Wordpress,Vue.js,有人能告诉我为什么在输出post数据时出错吗 我尝试过添加一些参数,比如标题、内容,但都不起作用。我可以补充一点,我可以使用id让它工作 <template> <section class="container animated fadeIn"> <nuxt-link :to="{ name: 'blog' }"> Back to Blog </nuxt-link>

有人能告诉我为什么在输出post数据时出错吗

我尝试过添加一些参数,比如标题、内容,但都不起作用。我可以补充一点,我可以使用id让它工作

    <template>
      <section class="container animated fadeIn">
        <nuxt-link :to="{ name: 'blog' }">
          Back to Blog
        </nuxt-link>
        <div>
          <h1 class="title">
             {{ post }}  <!-- this returns an array of the post data  -->
              {{ slug }} <!-- this returns the slug  -->
                {{ post.title }} <!-- this returns an error  _vm.post is undefined  -->
          </h1>
        </div>
      </section>
    </template>
    <script>
    import axios from 'axios'
    export default {
      name: 'post',
      data () {
        return {
          slug: this.$route.params.slug,
          post: {},
          error: []
        }
      },
      asyncData ({ params }) {
        return axios.get(`http://localhost/amcdwp/wp-json/wp/v2/posts/?slug=${params.slug}`)
          .then((response) => {
            return { post: response.data }
          })
      }
    }
    </script>

回到博客
{{post}}
{{slug}}
{{post.title}}
从“axios”导入axios
导出默认值{
姓名:"职位",,
数据(){
返回{
slug:this.$route.params.slug,
职位:{},
错误:[]
}
},
asyncData({params}){
返回axios.get(`http://localhost/amcdwp/wp-json/wp/v2/posts/?slug=${params.slug}`)
。然后((响应)=>{
返回{post:response.data}
})
}
}

我想输出单个数据,如post.title。我得到一个错误_vm.post未定义

如果
{{post}}
返回您指定的数组,您不需要访问特定的索引吗,例如
{post[0].title}
?您好,是的,可以工作,谢谢您,但是我如何进入meta:meta:[{hid:'description',id:'description',name:'description',content:'say if you want post title here'}]谢谢你,我成功了,很傻,但我正在尝试循环,你让我走上了正确的轨道