In the tab element called competences
, there is an input field with the reference search
.
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a @click="competencesTabClick" aria-controls="Company" aria-selected="true" class="nav-link active" data-toggle="tab" href="#tab1" id="tab1-tab" ref="tab1" role="tab">Competences
</a>
</li>
<li class="nav-item" v-if="authrzCompetencesEdit">
<a @click="competencesByUser(0)" aria-controls="other" aria-selected="false" class="nav-link" data-toggle="tab" href="#tab2" id="tab2-tab" role="tab">Logs</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div aria-labelledby="tab1-tab" class="tab-pane fade show active" id="tab1" role="tabpanel">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<input @keyup="search($event)" autocomplete="off" class="form-control" ref="search" placeholder="Search" type="text">
</div>
</div>
....
Upon clicking on the tab, the method @click="competencesTabClick"
is executed to focus on the input field with the reference search
.
The issue (feel free to correct me) appears to be that the element is not loaded at that time.
Is there a way to delay the execution of the competencesTabClick
method until the input element is fully loaded?
Here is the definition of the competencesTabClick
function:
competencesTabClick(){
this.$refs.search.focus();
},