Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input 设置 focus或者 auto-focus,进入页面后无法自动聚焦 #10579

Closed
491467928 opened this issue Nov 4, 2021 · 1 comment · Fixed by #10719
Closed

input 设置 focus或者 auto-focus,进入页面后无法自动聚焦 #10579

491467928 opened this issue Nov 4, 2021 · 1 comment · Fixed by #10719
Labels
F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@491467928
Copy link

相关平台

微信小程序

复现仓库

https://gitee.com/wwxxll/taro-test
小程序基础库: 2.20.1
使用框架: Vue 3

复现步骤

进入有设置focus的input的页面即可

期望结果

进入页面后input获得焦点,弹出输入键盘

实际结果

没有获得焦点

环境信息

 Taro CLI 3.3.12 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.17.5 - C:\Program Files\nodejs\node.EXE
      npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD


补充信息

Taro版本是3.3.12

@taro-bot2 taro-bot2 bot added F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Nov 4, 2021
@Chen-jj
Copy link
Contributor

Chen-jj commented Nov 23, 2021

@491467928 和 Vue3 的逻辑有冲突而导致。

注意 Vue3 shouldSetAsProp 这个方法:

https://github.com/vuejs/vue-next/blob/e7b0a9d3cffc938d3add7dcde02d0991f60c6ec9/packages/runtime-dom/src/patchProp.ts#L33-L60

Vue3 判断 focus 这个属性在 el 中,就把它作为 dom property 设置了,其实 Taro 希望它能作为 attribute 设置。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants