Using v-for v-model data and binding loop

v-model can be two-way data binding, if the data in the situation data group exists, may be acquired value of the name corresponding to the value specified by the value in the key way value.name when binding.

<td v-model="value.store_user_id">{{value.store_user_id}}</td>

The wording can easily help us find a certain special value.

v-for data objects may be output in the iteration, when the data object is complicated, can be used value, key simplified method. Note that the data is key: value storage situation, where the key and value are not actually refers to the data key-value pairs, but rather refers to a layer of abstraction that all keys in adminlist.data.data after the pair.

<tr class="text-c" v-for="(value, key) in adminlist.data.data">
......
</tr>

I use the v-for = "(value, key) in adminlist.data.data" to indicate that one of the keys to all subsequent iterations of the loop adminlist.data.data, with value.xxx to represent the corresponding value, and with v-model to bind it.

<tr class="text-c" v-for="(value, key) in adminlist.data.data">
<td><input type="checkbox" v-bind:value="key" name=""></td>
<td v-model="value.store_user_id">{{value.store_user_id}}</td>
<td v-model="value.user_name">{{value.user_name}}</td>
<td v-model="value.password">{{value.password}}</td>
<td v-model="value.real_name">{{value.real_name}}</td>
<td v-model="value.is_super">{{value.is_super}}</td>
<td v-model="value.is_delete">{{value.is_delete}}</td>
<td v-model="value.wxapp_id" class="td-status"><span class="label label-success radius">{{value.wxapp_id}}</span></td>
</tr>

The method may be used certain value of the data object in some way out of iterations.

Guess you like

Origin blog.csdn.net/weixin_44724060/article/details/88146731