How to keep one decimal place in js input

problem description

the page retains a decimal place when the requirement is entered, not after the input, but by entering 1, which is displayed directly as 1.0.

the environmental background of the problems and what methods you have tried

I have done the method of limiting one decimal place, but the test shows that it is 1 place when I want to enter it. In the past, when I used to keep the decimal place, it was mostly displayed. When this kind of input is done, I have no idea. Vue and element used in the front-end framework are displayed on Synchronize.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Mar.29,2021

num.toFixed (1)


/ (^ [1-9]\ d * (\.\ d {1})? $) | (^ 0\.\ d {1} $) | ^ 0$/.test (yourValue)

Menu