How does WeChat Mini Programs traverse the form to accurately assign values to the corresponding parameters?

as shown in the figure, every time you click to create a new item, there will be a line of form, because traversing an array, so how to accurately assign the value to the corresponding object?
and how to delete a piece of data accurately? I use data-index= "{{index}}" to get the corresponding subscript, and then delete splice (index, 1) in the array, but delete it from the bottom to the top every time.

Feb.20,2022

JS does not have a method to delete a specific piece of data directly. You need to optimize this method with your own algorithm


first of all, delete splice (index, 1 in the array after you say this sentence, but delete it from the bottom up every time. Please check that the usage of splice is to change the original array. Secondly, this method is theoretically possible. There is nothing wrong with re-giving state after each deletion. I'm sorry I've been too busy lately.

Menu