显示Vue meta i18n变量名称而非值
P粉510127741
P粉510127741 2023-08-26 18:52:56
0
1
326
<p>我有一个vue2项目,使用了vue-meta和vue-i18n来本地化项目。 在我的浏览器书签中,网页的标题没有显示出来,而是显示了变量。在谷歌分析中也出现了相同的问题,似乎显示了变量而不是变量中的值。</p> <p>这是我Home组件的代码片段:</p> <pre class="brush:php;toolbar:false;">name: 'Home', metaInfo () { return { title: this.$t(&quot;home.meta.title&quot;), meta: [{ name: &quot;description&quot;, content: this.$t(&quot;home.meta.descriptioncontent&quot;) }, { name: &quot;keywords&quot;, content: this.$t(&quot;home.meta.keywordscontent&quot;) }, { property: 'og:title', content: this.$t(&quot;home.meta.title&quot;)}, { property: 'og:site_name', content: 'www.examplesite.se'}, { property: 'og:description', content: this.$t(&quot;home.meta.descriptioncontent&quot;)}, { property: 'og:type', content: 'Home'}, { property: 'og:url', content: 'https://examplesite.se/'}, { property: 'og:image', content: 'https://www.examplesite.se' + '/img/' + 'example_logo_social.png'} ] } }, data() { return { fimagefolder: '../../Images/', bimagefolder: '../../fImages/', }; },</pre> <p>所以this.$t(&quot;home.meta.title&quot;)变量存储了瑞典语和英语的翻译。在网站内部,它显示了两种语言的正确标题,但是谷歌分析只显示了&quot;home.meta.title&quot;。</p> <p>据我所了解,爬虫程序由于没有加载任何脚本,无法看到我的变量值。有什么想法吗?</p>
P粉510127741
P粉510127741

最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!