Open duanmw opened 4 years ago
me too
me too
me too
me too +1
This problem still exists in version 2.13.2, but the demo is normal
me to
好像是浏览器的问题,测试了一下,新版chrome就存在这个问题,但是在360极速浏览器上就没这个问题了
经测试,这样可以解决问题
给出解决方案如下,大致思路就是讲原来的input组件内部两个文件copy出来,封装成自己的组件,然后在引入element后面(记得要在引入element后面)将你copy出来的input组件封装成全局组件,并且修改input组件288行focus方法,具体看下图。
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
经测试,这样可以解决问题
还是有很多公司一直使用的element的老版本进行开发的,这样的方法能解决问题但最好还是官方出手解决更为妥当. 除非老版本不在维护
mounted () {
this.$watch(
() => {
return this.$refs.input.passwordVisible
},
(val) => {
this.$refs.input.blur();
this.$refs.input.focus();
}
)
}
Element UI version
2.13.0
OS/Browsers version
win10 / Chrome Version 79.0.3945.88
Vue version
2.6.1
Reproduction Link
https://codepen.io/duanmw/pen/YzPrdmv
Steps to reproduce
Go to codepen.io and run the password box demo on element's official website. After entering the password in the password box, the input cursor is at the end. But after clicking the "Show Password" button, the cursor at this time will automatically move to the beginning of the password box.
What is Expected?
Input prompt cursor position remains unchanged.
What is actually happening?
Input prompt cursor position changed to the beginning.