Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/386.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在vue2中保留筛选列表中项目的引用_Javascript_Vuejs2 - Fatal编程技术网

Javascript 如何在vue2中保留筛选列表中项目的引用

Javascript 如何在vue2中保留筛选列表中项目的引用,javascript,vuejs2,Javascript,Vuejs2,所以我有一个列表,我在上面制作卡片,看起来像这样 我想在单击“+”按钮时更新卡中的金额,我以前是在做列表的索引,但每次筛选列表时,索引都会更改,并且更新了错误的数据 任何关于如何修复此问题的想法只需将该项作为卡片组件的道具传递给NumberInputSpinner组件即可 <card v-for="item in tableFilter" :name="item.name" @commission_change="updateComission" :amount="item.amount

所以我有一个列表,我在上面制作卡片,看起来像这样

我想在单击“+”按钮时更新卡中的金额,我以前是在做列表的索引,但每次筛选列表时,索引都会更改,并且更新了错误的数据


任何关于如何修复此问题的想法只需将该项作为卡片组件的道具传递给NumberInputSpinner组件即可

<card v-for="item in tableFilter" :name="item.name" @commission_change="updateComission" :amount="item.amount" :item="item"></card>

<numberinputspinner :min="0" :max="2" :step="0.0001" @newNumber="updateTable" :item="item" />

如果要更新card组件中的项目引用,只需从numberInputSpinner发出一个update_事件,然后更新cardComponent中的项目引用


更新的小提琴:

@WannyMiarelli是的,请检查Js小提琴
<card v-for="item in tableFilter" :name="item.name" @commission_change="updateComission" :amount="item.amount" :item="item"></card>

<numberinputspinner :min="0" :max="2" :step="0.0001" @newNumber="updateTable" :item="item" />
increaseNumber() {
  this.numericValue += this.step;
  this.item.amount += this.step;
},