我有两个表(项目,任务)。
id - title - desc - others_column
1 - title - desc - others
2 - title - desc - others
Run Code Online (Sandbox Code Playgroud)
id - title - desc - project_id - parent_id - others_column
1 - title - desc - 1 - null - others
2 - title - desc - 1 - 1 - others
3 - title - desc - 2 - null - others
4 - title - desc - 2 - 3 - others
Run Code Online (Sandbox Code Playgroud)
我试图查询,项目控制器看起来像这样。 …
我的 vue 组件代码如下所示。
data: function () {
return {
products: [
{ product_id: '', price: ''},
{ product_id: '', price: ''},
],
}
},
Run Code Online (Sandbox Code Playgroud)
现在我想在 v-model="product_id" 更改时获取对象索引。有什么解决办法可以得到吗?
<div v-for="(product, key) in products">
<input type="text" v-model="product.product_id" />
<input type="text" v-model="product.price" />
</div><!-- /.div -->
Run Code Online (Sandbox Code Playgroud)
谢谢