Here is the input-select code snippet:
<input-select v-model="county" id="county" :options="getCountyList()">
† County
</input-select>
The function getCountyList()
is defined as follows:
getCountyList: function () {
var retarr = [];
for (let i = 0; i < json.length; i++) {
if (json[i].state_id == this.state) {
// here STATE selected in previous drop down,
// match it with state from json and get COUNTY
retarr[i] = json[i].county_name;
}
}
const mySet = new Set(retarr); //remove duplicates and get DISTINCT County list
console.log("this is mySet COUNTY return array :", mySet);
return mySet;
};
The output of
console.log ("this is mySet COUNTY return array :",mySet )
is as follows:
0: undefined
1: "St. Clair"
2: "Jefferson"
3: "Shelby"
4: "Tallapoosa"
5: "Blount"
6: "Talladega"
7: "Marshall"
8: "Cullman"
9: "Bibb"
10: "Chilton"
11: "Walker"
However, the issue faced is that v-model="county"
is receiving keys like 1
, 2
, 3
instead of the actual COUNTY Name upon selection. How can this be resolved?