seperate method for loading stations

This commit is contained in:
Jonas Heinrich 2020-10-17 12:06:21 +02:00
parent 316b04368c
commit 610953fc1b
2 changed files with 13 additions and 8 deletions

View File

@ -49,11 +49,16 @@ export default {
tableData: undefined,
}),
mounted() {
const vm = this
this.$jquery.getJSON('https://de1.api.radio-browser.info/json/stations/topclick?limit=20')
.done(function(data) {
vm.tableData = data
})
this.loadStations()
},
methods: {
loadStations() {
const vm = this
this.$jquery.getJSON('https://de1.api.radio-browser.info/json/stations/topclick?limit=20')
.done(function(data) {
vm.tableData = data
})
},
},
}
</script>

View File

@ -10,14 +10,14 @@
</tr>
</thead>
<tbody v-if="stationData">
<tr v-for="(obj, ind) in stationData" :key="ind">
<tr v-for="station in stationData" :key="station">
<td>
<div class="stationIcon"
:style="{ backgroundImage: `url('${ obj.favicon }')` }" />
:style="{ backgroundImage: `url('${ station.favicon }')` }" />
</td>
<td class="filenameColumn">
<span class="innernametext">
{{ obj.name }}
{{ station.name }}
</span>
</td>
<td class="actionColumn">