https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html
搞了半天,遇到一个很奇怪的问题,本来是想用此方法解决input焦点问题,这里又遇到新问题,快把我搞崩溃了。
//wxml
<input id="myInput" class="input" focus="false" worklet:onkeyboardheightchange="onHeightChange" bindkeyboardheightchange="onHeightChange2"
style="text-align: left; padding: 5px;" cursor="0" placeholder="专业名称:如国际贸易" />
//js onHeightChange2 中
wx.createSelectorQuery().in(this).select('#myInput').boundingClientRect(rect => {
console.log(rect) //这 里有值
}).exec();
wx.createSelectorQuery().in(this).select('#myInput').node((res) => {
console.log(res) //这里是undefined
//res.blur();
}).exec();
请按照链接提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
我也碰到了相同的问题请问怎么解决的