【问题标题】:Doesn't add meta tags - Vue and declandewet/Vue-meta不添加元标记 - Vue 和 declandewet/Vue-meta
【发布时间】:2019-05-21 04:18:11
【问题描述】:

大家好,感谢您的帮助。

本项目使用 Vue-CLI、Vue-Router 和 Vue-meta。 我想更新元标记描述和关键字。 目前,元标题已正确更新,但我无法更新描述和关键字。

//App.vue
    metaInfo: {
        title: 'App',
        titleTemplate: '%s | My Awesome Webapp',
        meta: [
            {vmid: 'description', property: 'description', content: 'meta1'},
            {vmid: 'keywords', property: 'keywords', content: 'keys1'}
        ]
    }

//home.vue
      name: 'home',
        metaInfo: {
            // title: 'My Page Title',
            // titleTemplate: '%s',
            meta: [
                {vmid: 'description', property: 'description', content: 'meta2'},
                {vmid: 'keywords', property: 'keywords', content: 'keys2'}
            ]
        }

    //index.html
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title></title>
    <meta name="description" content="">
    <meta name="keywords" content="">
</head>

感谢您的帮助,

【问题讨论】:

  • 你解决了吗?

标签: vue.js vue-router vue-meta


【解决方案1】:

尝试使用metaInfo 字段作为函数调用

metaInfo: () => ({
  meta: [{ name: 'description', content: 'Hello', vmid: 'test' }],
})

【讨论】:

  • 感谢您的回答@Indrek Lasn。不幸的是,它没有用。
猜你喜欢
  • 2022-06-19
  • 2021-08-19
  • 2021-08-09
  • 2019-01-25
  • 1970-01-01
  • 2022-11-10
  • 2020-04-08
  • 2018-04-01
  • 1970-01-01
相关资源
最近更新 更多