I am trying to bind data from combobox I selected to its own input but every time I select an item of combobox 1 combobox 2 will also show combobox 1 item. Below is the code I wrote
HTML
// Combobox 1
<div style="height: 40px">
<div class="m-combobox" id="cbbWorkStatus">
<div class="m-combobox-label">Tình trạng công việc</div>
<div
class="select-list"
:class="
isActivate === 'workstatus' ? 'sl-activate' : 'inactive'
"
ref="selectList"
>
<div
class="select-item"
:value="item.WorkStatusId"
v-for="item in workStatuses"
:key="item.WorkStatusId"
@click="isSelect"
>
<i class="fas fa-check"></i>
<div class="select-item-text">
{{ item.WorkStatusName }}
</div>
</div>
</div>
<div class="select">
<input
class="m-combobox-input"
type="text"
placeholder="Chọn/Nhập thông tin"
value=""
tabindex="15"
id="txtWorkStatus"
fieldname="WorkStatus"
format="workStatus"
v-model="selectedValue" <----------------
/>
<div
class="m-combobox-button"
@click="activateCbb('workstatus')"
>
<i class="fas fa-angle-down"></i>
</div>
</div>
</div>
</div>
//Combobox 2
<div style="height: 40px">
<div
class="m-combobox"
id="cbbDepartment"
cbbname="DepartmentName"
cbbid="DepartmentId"
>
<div class="m-combobox-label">Phòng ban</div>
<div
class="select-list"
style="z-index: 100"
:class="
isActivate === 'department' ? 'sl-activate' : 'inactive'
"
ref="selectList"
>
<div
class="select-item"
v-for="item in departments"
:value="item.DepartmentId"
:key="item.DepartmentId"
@click="isSelect"
>
<i class="fas fa-check"></i>
<div class="select-item-text">
{{ item.DepartmentName }}
</div>
</div>
</div>
<div class="select">
<input
class="m-combobox-input"
type="text"
placeholder="Chọn/Nhập thông tin"
value=""
tabindex="11"
id="txtDepartment"
fieldname="DepartmentId"
format="department"
v-model="selectedValue" <--------------
/>
<div
class="m-combobox-button"
@click="activateCbb('department')"
>
<i class="fas fa-angle-down"></i>
</div>
</div>
</div>
Data
data() {
valueInput: null,
}
Methods
created() {
this.selectedValue = this.valueInput;
},
But this way, when I select the item in the combobox above, the combobox below is also displayed. I want each combobox to show only their item. Thank all!