以正常方式无需翻译,但我想翻译两个对象数组并绑定到组件中
<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",
},
],
}; Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
使
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"), }, ] }; } }