以正常方式無需翻譯,但我想翻譯兩個物件數組並綁定到組件中
#<InfoNews v-for="infonew in infonews" :id="infonew.id" :title="infonew.title" :content="infonew.content" /> data() { return { infonews: [ { id: "01", title: "what we do", content:"industke aecimen book. ", }, { id: "02", title: "our mission", content:"ggdddg", }, ], };
P粉8846670222024-03-22 10:23:33
使 infonews
成為計算屬性。每個的 title
和 content
應該是翻譯鍵。
export default { computed: { infonews() { return [ { id: "01", title: this.$t("what we do"), content: this.$t("industke aecimen book"), }, { id: "02", title: this.$t("our mission"), content: this.$t("ggdddg"), }, ] }; } }