I have some important data
https://i.sstatic.net/Cq2t6.png
Challenge
I'm facing difficulty in accessing the tubes
array within my data
Solution
script
data() {
return {
types: []
}
},
methods: {
handleChange (val) {
axios.get(`/api/admin/getFromTubes/${val}`)
.then(res => {
this.types = res.data.data.tubes;
})
.catch(error => {
console.log(error);
})
}
}
template
<el-form-item label="Old Core">
<el-select style="width: 100%;" filterable clearable v-model="form.old_core_id" placeholder="Select Old Core">
<el-option
v-for="cable in types"
:key="cable.id"
:label="cable.name"
:value="cable.id">
<span style="float: left">
{{ cable.name }}
</span>
</el-option>
</el-select>
</el-form-item>
Inquiry
Any suggestions on how to properly display the tubes
array in the select dropdown template?