我正在尝试使用以下代码设置动态开放图元标记
async asyncData({ app, route }) {
let postDetails = await app.$axios.get(`/api/v1/news/single/${route.params.id}`);
postDetails = postDetails.data.post;
return { postDetails };
},
head() {
return {
meta: [
{ hid: 'title', name: "title", content: this.postDetails.title },
{ hid: "description", name: "description", content: this.postDetails.body },
{ hid: "twitter:image", name: "twitter:image", content: this.postDetails.image },
{ hid: "twitter:card", name: "twitter:card", content: "summary_large_image" },
{ hid: "og:image",name: "og:image", content: this.postDetails.image },
{ hid: "og:image:secure_url", name: "og:image:secure_url", content: this.postDetails.image },
{ hid: "og:title", name: "og:title", content: this.postDetails.title },
{ hid: "og:description", name: "og:description", content: this.postDetails.body },
{ hid: "description", name: "description", content: this.postDetails.body },
{ hid: "og:url", name: "og:url", content: window.location.href }
]
};
},
我已经记录了 postDetails 并且数据在 asyncData 函数中。现在,当我打开页面并检查元标记时,元标记已完全更改,但是当我打开 facebook 并粘贴或按 ctrl + u 时,它只显示其默认打开的图形标记。我在这里做错了什么?有人可以帮忙吗?