Vue.js v-对于数组或对象中的每个对象文本

Vue.js v-for each object text with in an array or objects

我想列出包含对象的数组中的文本。我似乎无法弄清楚如何解决这个问题我可以接近...

例如

<template>
  <div>
    <ul>
      <li v-for="(value, index) in otherclients" v-bind:key="index">
        DATA = {{ value.doc.notes }}
      </li>
    </ul>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  name: 'Viewer',
  computed: mapState({
    otherclients: state => state.otherclients
  })
}
</script>

<style lang="css" scoped></style>

会输出

但我想要的是

但我似乎想不出进入最后一层的最佳方法。 任何指针都适用。这是一个更大项目的一部分,因此结构设置为 state.otherclients 并且非常复杂。

使用带有 template 标签的嵌套 for 循环

<template>
  <div>
    <ul>
      <template v-for="(value, index) in otherclients">
         <li v-for="(note, note_index) in value.doc.notes">{{note.text}}</li>
      </template>
    </ul>
  </div>
</template>

var app = new Vue({
 el: '#app',
 data:{
  name:'niklesh',
  otherclients:[
    {doc:{notes:[ { "id": "w5fpn80fnnf5nxdj9f1n1i", "text": "Welcome new device mydoc_android", "owner": "YOU", "deleted": false }, { "id": "w5fpn80fnnf5nxdj9f1wwwn1i", "text": "android 2", "owner": "YOU", "deleted": false } ]}},
    {doc:{notes:[ { "id": "c1ds7zqd7tcgig0b1xs1q", "text": "Welcome new device mydoc_ios", "owner": "YOU", "deleted": false }, { "id": "nf5nxdj9f1dwwen1iw5fpn80fn", "text": "More Text", "owner": "YOU", "deleted": false } ]}},
  ]
 }
});

//[[{text:'test11'},{text:'test12'}]},[{text:'test21'},{text:'test22'}]}]
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.js"></script>
<div id="app">
      <ul>
      <template v-for="(value, index) in otherclients">
        <li v-for="(note, note_index) in value.doc.notes">{{note.text}}</li>
      </template>
      </ul>
 </div>