element-plus [Component] [input] input使用formatter光标位置错误

xmd2e60i  于 2个月前  发布在  其他
关注(0)|答案(2)|浏览(68)

Bug Type: Component

Environment

  • Vue Version: 3.2.45
  • Element Plus Version: 2.2.27
  • Browser / OS: Chrome 108.0.5359.98/ macOS 13.1
  • Build Tool: Vite

Reproduction

  • el-input

Element Plus Playground

Steps to reproduce

input绑定初始值为'22222222',formatter返回值为 ${val} .replaceAll('2', '!'),光标初始位置处于绑定值中间任意位置,输入字符2,光标会跳到最后位置

What is Expected?

光标保持在输入位置

What is actually happening?

光标跳到最后位置

Additional comments

(empty)

ffdz8vbo

ffdz8vbo1#

replaceAll 替换为了一个新的字符串,替换完成之后光标在字符串被顶到最后,感觉应该是正常行为

oknrviil

oknrviil2#

Hi. The problem is that the formatter is not called during initialization. When this pr is merged, then the cursor will work correctly (the first time a number is entered)

相关问题