You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using VanJS to create an input element with type number below, setting its value to a state, and then updating the value of this state in the oninput event of the element. When the input value in the element is 1.x, the cursor stays after x. However, when the delete key is pressed at this point, under normal circumstances, the cursor should move from after x to after ., and then x should be deleted. However, in the VanJS example below, after x is deleted, the input's value becomes 1, and the cursor moves in front of 1. This is obviously incorrect. Is this related to how VanJS updates the DOM content?
This is due to the behavior of number-typed <input> element. When you delete x, event.target.value equals 1, not 1., as only numbers are allowed in the input box.
Yeah, I understand x means a number. My point is: event.target.value equals 1 for the input event that is triggered when you delete the number after the decimal point. This is the behavior of the DOM element.
Using VanJS to create an input element with type
number
below, setting its value to a state, and then updating the value of this state in the oninput event of the element. When the input value in the element is1.x
, the cursor stays afterx
. However, when the delete key is pressed at this point, under normal circumstances, the cursor should move from afterx
to after.
, and thenx
should be deleted. However, in the VanJS example below, afterx
is deleted, the input's value becomes1
, and the cursor moves in front of1
. This is obviously incorrect. Is this related to how VanJS updates the DOM content?The text was updated successfully, but these errors were encountered: