尝试使用字符串+变量设置Vue元页面标题

Rya*_*ton 4 javascript vue.js nuxt.js vue-meta

我使用 Vue Meta 作为使用 Nuxt JS 2.4.5 的项目中博客应用程序的一部分

我在尝试设置标题+变量时遇到一些麻烦data (),我不确定我错过了什么

我已经尝试了多次尝试让它工作,移动代码,使用this手动设置它,似乎没有任何效果......

<script>
import BlogsFromJson from '~/static/articles/blogs.json';

export default {
  head: {
    title: 'My Website: Blog: ' + this.myBlogTitle, // or something else
    meta: [
      { hid: 'description', name: 'description', content: 'Read the latest news and articles from Flex Repay UK.' }
    ]
  },
  data () {
    return {
      title: this.$route.params.title,
      blog: BlogsFromJson,
      myBlogTitle: 'some title'
    }
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

我尝试在其中设置一个变量data ()并静态使用它。

这样做应该给我My Website: Blog: some title

我在这里可能会缺少什么?

NaN*_*NaN 6

尝试使用函数而不是对象作为头部。改变

head: {
  ...
},
Run Code Online (Sandbox Code Playgroud)

head () {
  return {
    ...
  }
}
Run Code Online (Sandbox Code Playgroud)