observableArrays do have a replace
method. This takes in the old item and the new item.
So, you would call it like:
ViewModel.Elements.replace(ViewModel.Elements()[index], yourNewElement);
Internally, this just sets that index to your new item and calls valueHasMutated() to notify any potential subscribers.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…