-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b79a46
commit f4dbae9
Showing
5 changed files
with
100 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import Accueil from "./components/Accueil"; | ||
import Page1 from "./components/Page1"; | ||
import Articles from "./components/Articles"; | ||
import Page2 from "./components/Page2"; | ||
import Post from "./components/Post"; | ||
|
||
export default [ | ||
{ path: "/", component: Accueil }, | ||
{ path: "/page1", component: Page1 }, | ||
{ path: "/blogposts", component: Articles }, | ||
{ path: "/page2", component: Page2 }, | ||
{ path: "/blogpost/:id", component: Post }, | ||
{ path: "/blogposts/:id", component: Post }, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<main class="container-fluid"> | ||
|
||
|
||
<div class="row"> | ||
<div class="col text-center"> | ||
<h1>Les articles de blog !</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
|
||
<ul class="list-group list-group-flush"> | ||
<li | ||
v-for="(article, index) in allArticles" | ||
:key="index" | ||
class="list-group-item list-group-item-action" | ||
> | ||
<router-link :to="`/blogposts/${index + 1}`"> | ||
|
||
<div class="card"> | ||
<div class="card-body"> | ||
{{ article.title }} | ||
</div> | ||
</div> | ||
|
||
</router-link> | ||
|
||
</li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
</main> | ||
</template> | ||
|
||
<script> | ||
import axios from "axios"; | ||
export default { | ||
name: "Articles", | ||
data() { | ||
return { | ||
allArticles: [], | ||
}; | ||
}, | ||
created() { | ||
axios | ||
.get("https://jsonplaceholder.typicode.com/posts") | ||
.then((reponse) => { | ||
console.log(reponse); | ||
for (const blogPost of reponse.data) { | ||
this.allArticles.push(blogPost); | ||
} | ||
}); | ||
}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
/* .list-group-item{ | ||
border:none | ||
} */ | ||
.list-group-item-action:focus, | ||
.list-group-item-action:hover { | ||
background-color: #b0d5fc; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters