correction de l'affichage des composants riot
This commit is contained in:
+2
-5
@@ -21,9 +21,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { fetchFormations } from './api.js'
|
|
||||||
import { createFormation } from './formation.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
state: {
|
state: {
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -40,13 +37,13 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await fetchFormations(query)
|
const data = await window.fetchFormations(query)
|
||||||
const formations = []
|
const formations = []
|
||||||
|
|
||||||
if (data.results) {
|
if (data.results) {
|
||||||
for (let i = 0; i < data.results.length; i++) {
|
for (let i = 0; i < data.results.length; i++) {
|
||||||
const raw = data.results[i]
|
const raw = data.results[i]
|
||||||
const formation = createFormation(raw)
|
const formation = window.createFormation(raw)
|
||||||
formations.push(formation)
|
formations.push(formation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
Chargement...
|
Chargement...
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div each={ f, i in props.results }
|
<div each={ (f, i) in props.results } key={ f.id } style="border:1px solid #ccc; padding:10px; margin:10px;">
|
||||||
key={ f.id }
|
|
||||||
style="border:1px solid #ccc; padding:10px; margin:10px;">
|
|
||||||
<h3>{ f.nom }</h3>
|
<h3>{ f.nom }</h3>
|
||||||
<p><b>Établissement :</b> { f.etablissement }</p>
|
<p><b>Établissement :</b> { f.etablissement }</p>
|
||||||
<p><b>Ville :</b> { f.ville } ({ f.departement })</p>
|
<p><b>Ville :</b> { f.ville } ({ f.departement })</p>
|
||||||
|
|||||||
@@ -15,6 +15,14 @@
|
|||||||
<script src="./components/detail-view.riot" type="riot"></script>
|
<script src="./components/detail-view.riot" type="riot"></script>
|
||||||
<script src="./app.riot" type="riot"></script>
|
<script src="./app.riot" type="riot"></script>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import { fetchFormations } from './api.js'
|
||||||
|
import { createFormation } from './formation.js'
|
||||||
|
|
||||||
|
window.fetchFormations = fetchFormations
|
||||||
|
window.createFormation = createFormation
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
riot.compile().then(() => {
|
riot.compile().then(() => {
|
||||||
riot.mount('app')
|
riot.mount('app')
|
||||||
|
|||||||
Reference in New Issue
Block a user