问题景象
起因
起因验证:在chrome调试台获取该input元素,执行input.focus()
,而后点击input框呈现下拉列表
尝试
- 在我的项目中,用DOM操作获取该input元素,而后
input.focus()
有效 - 将dialog和popover增加到body上 有效
解决办法
- 给该el-date-picker增加属性
:teleported="false"
popper-class="need-focus-input"
定义类
<style lang="scss">.need-focus-input{ position: fixed !important; left: 570px !important; //定位按本人我的项目地位需要来 top: 252px !important; //定位按本人我的项目地位需要来 margin: 0px !important; .el-popper__arrow{ top:407px !important; }}</style>
留神:因为下拉框没有增加在body上,所以不能在style scoped中定义该类