HTML
<div v-for="(item, index) in dataList" :key="index">
<span>{{ item.title }}:</span>
<span>{{ dataInfo[item.content] }}</span>
</div>
JS
需要展示的键值对放入数组中
let dataList = [
{
title: 'data1',
content: 'data'
},
{
title: 'data2',
content: 'content'
},
{
title: 'data3',
content: 'message'
}
]
对象信息
let dataInfo = {
data: '数据',
content: '内容',
message: '信息'
}