【发布时间】:2020-03-23 19:49:00
【问题描述】:
我必须为我的文章显示动态元描述,而我正在努力使用我的 head 对象的 async 函数来实现这一点。这是我目前所拥有的:
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
@Component
export default class ArticleContent extends Vue {
article: any | null = null;
articlelist = example.data;
async asyncData({params: any }) { <----- Not sure how I could put in my articlelist here
return this.articlelist;
}
head(): object {
return {
title: this.articlelist.productId.productNames['en'],
meta: [
{
hid: this.articlelist._id,
name: this.articlelist.productNames['en'],
content: this.articlelist.metaDescription['en'],
},
],
};
}
}
</script>
articlelist 是我在 head() 对象中用于元描述的内容。不胜感激!
【问题讨论】:
标签: javascript typescript vue.js nuxt.js