如何在Vuejs模板中循环遍历数组内的对象?

问题描述 投票:-4回答:1

我在数组中有一个对象。我对如何循环它有挑战。

我的数据如下:

the data

这是片段。我确定我是以错误的方式做到这一点。

<div v-for="(mes, i) in message" :key="mes.id">
                <div class="row">
                    <div class="input-field col s12">
                        <textarea name="text" id="input-message" v-model="mes[i].text" class="materialize-textarea"  data-length="200"></textarea>
                        <label for="input-message">Message</label>
                    </div>
                </div>

请知道解决方法。谢谢。

javascript arrays vuejs2
1个回答
1
投票

假设您有可用的消息,通用的方式是

<ul id="v-for-object" class="demo">
  <li v-for="value in message">
    {{ value.campaign_id }} ... {{ value.created_at }} ... your other properties listed in brackets
  </li>
</ul>

有关更多详细信息,您必须向我公开更多代码。

© www.soinside.com 2019 - 2024. All rights reserved.