Need help with Airtable multi-select field display
I’m working with Vue.js to show data from Airtable on my website. I’m pretty new to coding so I followed some basic tutorials to get started.
The problem: Regular text fields display perfectly, but multi-select fields show up weird like this: [ "Option1" ]
instead of just showing Option1
. Same thing happens with linked record fields but I care more about fixing the multi-select ones.
I’m using Airtable forms for people to submit data and want to keep the multiple choice options working properly on the display side.
Here’s my Vue code:
var myApp = new Vue({
el: '#content',
data: {
records: []
},
mounted: function(){
this.fetchData();
},
methods: {
fetchData: function(){
var vm = this
var baseId = "your-base-id";
var apiKey = "your-api-key";
this.records = []
axios.get(
"https://api.airtable.com/v0/"+baseId+"/People?view=Main%20view",
{
headers: { Authorization: "Bearer "+apiKey }
}
).then(function(result){
vm.records = result.data.records
}).catch(function(err){
console.log(err)
})
}
}
})
And the HTML template:
<div id="content">
<div class="card-list">
<div v-for="record in records" class="card">
<h2>{{ record['fields']['FullName'] }}</h2>
<p>Position: {{ record['fields']['JobTitle'] }}</p>
<p><strong>Tags: </strong>{{ record['fields']['Categories'] }}</p>
<p><strong>Skills: </strong>{{ record['fields']['Expertise'] }}</p>
<p><strong>Location: </strong>{{ record['fields']['City'] }}</p>
</div>
</div>
</div>
How can I make the multi-select fields show as normal text instead of array format? Thanks for any help!