理想的效果是:
標題一 內容一
標題二 內容二
標題三 內容三
實際上的效果是:
標題一 this.details.c1
標題二 this.details.c2
標題三 this.details.c3
<template>
<div>
<van-cell-group>
<van-cell
v-for="(item, index) in d_list"
:key="index"
:title='item.title'
:value="item.value"/>
</van-cell-group>
</div>
</template>
<script>
export default {
data() {
return {
details: {
c1: '內容一',
c2: '內容二',
c3: '內容三',
},
d_list: [
{
title: '標題一',
value: 'this.details.c1',
}, {
title: '標題二',
value: 'this.details.c2',
}, {
title: '標題三',
value: 'this.details.c3',
}
],
}
},
}
</script>
上面的details{}是從后臺傳過來的對象,能不能在不改變details{}的情況下,在html中循環輸出details{}中的屬性值和另外自己定義的title嗎
親測有效!