问题
When I click in Cars
. I want show me the image below.
Has anyone experienced this problem? I'm using Vue Devtools but can't inspect any components on a count of none are showing up.
Advert.vue
<template>
<div>
<ul class="list-group">
<li v-for="category in categories" @click="sendAdvert(category.id)" class="list-group-item display">
{{ category.name }}
</li>
</ul>
</div>
</template>
<script>
export default {
props: ['categories'],
data() {
return {
advert: [],
}
},
methods: {
sendAdvert(id) {
axios.get('/adverts/'+id)
.then(response => {
this.advert = response.data;
});
}
}
}
</script>
AdvertController.php
public function show(Request $request, $advert)
{
return Category::find($advert);
}
来源:https://stackoverflow.com/questions/54271912/how-to-show-data-in-database-in-vue-devtools