如圖所示:
點擊添加分組,出現輸入分組名稱的popover
需要該popover出現的同時,里面的el-input獲取焦點
嘗試一:給el-input添加autofocus屬性
chrome瀏覽器console面板如下反應:
Autofocus processing was blocked because a document already has a focused element.
嘗試二:在popover的show event中手動給el-input獲取焦點:
模板中:
@show="showPopover"
methods中:
showPopover() {
this.$nextTick(() => {
this.$refs.input.focus()
})
}
親測可行~