I have to display dynamic meta descriptions for my articles and I am kind of struggling to achieve that with the async function for my head object.
(我必须为我的文章显示动态的元描述,而我要用我的head对象的async函数来实现这一点很困难。)
This is what I have so far:(这是我到目前为止的内容:)
<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
is what I am using in the head()
object for my meta description.
(articlelist
是我在head()
对象中使用的元描述。)
Would appreciate some help!(希望能有所帮助!)
ask by AlyssaAlex translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…