Elementのautofocus失効問題の解決
512 ワード
理由:autofocusはvueのinputのオリジナル属性であり、elementもこの方法をサポートしているが、elementのel-inputコンポーネントの外には他のコンポーネントがあり、autofocusが失効し、手動でfocusメソッドを呼び出して集約するしかない.方法:
ref
this.$refs.myNameId.focus();
--------------------------------------------------------------------
ref
this.$nextTick(()=>{
let id = 'input'+this.form.id;
this.$refs[id].focus();
})