2 回答

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超4個(gè)贊
你可以做這樣的事情。
var meta = [{
name: "description", content: this.Post.Title
},
{
name: "date", content: this.Post.DateCreated
},
{
name: "author", content: this.Post.Author
}]
this.Tags.forEach(function (TagName, index) {
meta.push({ property: "tag", content: "TagName" })
})
metaInfo() {
return {
htmlAttrs: { lang: "en"
},
title: this.Post.Title,
// or you can just write "meta" instead of "meta: meta" its an shorthand // code
meta: meta
}
}

TA貢獻(xiàn)1770條經(jīng)驗(yàn) 獲得超3個(gè)贊
除非我遺漏了什么,否則您可以使用 push 并傳遞對(duì)象。
var meta = [];
meta.push({"property" : "tag","content" : "test"});
console.log(meta);
添加回答
舉報(bào)