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, tableData: undefined,
}), }),
mounted() { mounted() {
const vm = this this.loadStations()
this.$jquery.getJSON('https://de1.api.radio-browser.info/json/stations/topclick?limit=20') },
.done(function(data) { methods: {
vm.tableData = data 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> </script>

View File

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