After vue, changes the Boolean value of the v-if binding, dom is not updated immediately. Why, what is the solution?

A group of pictures that can be dragged with the mouse to change the value of left ((mousedown mousemove mouseup,)

double-click one of the pictures to change the Boolean value of its corresponding v-if (to delete the picture), but the view is not updated immediately , but is updated (deleted) as you continue to drag the set of pictures.

should be related to the response principle of vue, but because of beginners, I don"t quite understand it, so ask for guidance?

Jun.21,2021

you can watch monitor the value judged in your v-if, and display this value in the view to see if there are any updates. If it is a separate Boolean control in data. It should be updated immediately.


finally solved! The reason is that vue cannot monitor the addition or deletion of object attributes and needs to be deleted through Vue.delete.


when I encounter a situation similar to yours, you can take a look at this due to JavaScript restrictions, Vue cannot detect the following changing arrays

Menu