如何访问V-For上的数据? vuejs+类星体框架
我有以下代码,从搜索查询中获取产品是一个Q-Markup-table。当表中填充来自查询的产品时,我添加了一个按钮以选择一行,所选行将将行数据发送到数组,并将该数组发送到另一个名为“选定产品”的表,但是我如何将其加速到该阵列V-FOR数据(即:Producto.nombre)将其发送到新数组?
<q-markup-table flat bordered separator="cell">
<thead class="bg-blue-grey-1">
<tr>
<th class="text-left">Nombre</th>
<th class="text-right">Descripcion</th>
<th class="text-right">Precio</th>
<th></th>
</tr>
</thead>
<tbody v-for="producto in productos" :key="producto.producto_id">
<tr>
<td class="text-left">{{ producto.nombre }}</td>
<td class="text-right">{{ producto.descripcion }}</td>
<td class="text-right">{{ "$" + producto.precio }}</td>
<td class="text-right">
<q-btn
flat
class="text-primary"
label="Seleccionar"
@click="agregarProducto"
></q-btn>
</td>
</tr>
</tbody>
</q-markup-table>
I have the following code, it's a q-markup-table to get products from a search query. When the table gets filled with products from the query I added a button to select one row, the selected row will send the row data to an array and send that array to another table called "selected products", but how can I acces to the v-for data (i.e: producto.nombre) to send it to the new array?
<q-markup-table flat bordered separator="cell">
<thead class="bg-blue-grey-1">
<tr>
<th class="text-left">Nombre</th>
<th class="text-right">Descripcion</th>
<th class="text-right">Precio</th>
<th></th>
</tr>
</thead>
<tbody v-for="producto in productos" :key="producto.producto_id">
<tr>
<td class="text-left">{{ producto.nombre }}</td>
<td class="text-right">{{ producto.descripcion }}</td>
<td class="text-right">{{ "quot; + producto.precio }}</td>
<td class="text-right">
<q-btn
flat
class="text-primary"
label="Seleccionar"
@click="agregarProducto"
></q-btn>
</td>
</tr>
</tbody>
</q-markup-table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将产品传递到
calsgarproducto
,像这样...将完整的对象添加到选择...
Pass the product to
agregarProducto
, like this...Add the complete object to the selection...