It's pretty simple to move item in array via move , but unfortunately it's not suitable in my case as usual.
(通过move在数组中移动项目非常简单,但是不幸的是,它不适用于我以往的情况。)
For example I need to move object with index 0 from group #31 to #33 and set the new index for object in the destination array to 1.
(例如,我需要将索引为0的对象从组#31移动到#33,并将目标数组中对象的新索引设置为1。)
-
source_group_id
= 31 (source_group_id
= 31)
-
source_object_index
= 0 (source_object_index
= 0)
-
destination_group_id
= 33 (destination_group_id
= 33)
-
destination_object_index
= 1 (destination_object_index
= 1)
Data object model:
(数据对象模型:)
const stuff = {
"31": [
{------------------------------|
"id": "11", |============|
"title": "Just move me pls" | ||
},-----------------------------| ||
{ ||
"id": "12", ||
"title": "Ramda 123" ||
}, ||
], ||
"33": [ ||
{ ||
"id": "3", ||
"title": "Ramda jedi" ||
} ||
?==========================================|
],
"4321": [
{
"id": "1",
"title": "Hello Ramda"
}
]
}
Does anyone know how to solve this?
(有谁知道如何解决这个问题?)
ask by Arthur translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…