element-plus [Component] [input-number] Input Number Component autocompletes if you Type "0" when precision is set

mzsu5hc0  于 5个月前  发布在  其他
关注(0)|答案(8)|浏览(133)

Bug Type: Component

Environment

  • Vue Version: 3.2.45
  • Element Plus Version: 2.2.23
  • Browser / OS: Firefox 107.0 / Mac OS X 12.04
  • Build Tool: Other

Reproduction

  • el-input-number

Element Plus Playground

Steps to reproduce

If you want to Type a Number between 1 and 0 the Component Auto-Completes it to 0.00 and then attached the following typed numbers to the end wich then round it up to the decimal place that is set in the precision Attribute

What is Expected?

F.E if a gauge Test writes 0,8 in the Component

What is actually happening?

The Component converts it to 0.1 because it writes 0,008 in the Component

Additional comments

(empty)

yzckvree

yzckvree1#

I thinks it's normal ,this goes back to the value of :precision :step
So if you are looking for 0.08 , you just need to change the step value to :step="0.01" , for 0.008 : :precision="3" :step="0.001"

rur96b6h

rur96b6h2#

The 0,8 was just an example. Type a 0,5 to the Component in the Reproduction Link then you will see what i mean.

eh57zj3b

eh57zj3b4#

Wich Browser and OS do you use ? When i just type 0 the Component directly Autocompletes it to this:

This breaks my Gauge Tests because they cant handle that behaviour and just attach behind the 0.00

axr492tv

axr492tv5#

MAC OS X, make sure to put the :precision="1"

mrphzbgm

mrphzbgm6#

Still the same behaviour

i2loujxw

i2loujxw7#

Check out this one

You can put back the ref to 1 const num = ref(1)

t3irkdon

t3irkdon8#

Still, it worked fine until the last update

相关问题