I have passed an id to the url ie. (http://127.0.0.1:8000/admin/article/32). Now i want to get that id in vue to fetch the data only of that id but i have no idea to get that id in vue
my vue script is down below
<script>
export default{
data() {
return{
articles : [],
article: {
id :'',
title : '',
body : '',
date :''
},
article_id: ''
};
},
created() {
this.fetchArticles();
},
methods: {
fetchArticles() {
var page_url = 'http://127.0.0.1:8000/api/admin/article/'+ I want the parameter id here;
fetch(page_url)
.then(res => res.json())
.then(res => {
this.article = res.data;
})
.catch(err => console.log(err));
}
}
};
</script>