todo riot, avec router
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Riot todo</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<base href="/~denis/web_2024/tp5/todo-riot/">
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/riot@10.0.0/riot+compiler.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@riotjs/route@10.0.0/index.umd.js"></script>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="css/todo.css">
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
|
||||
>
|
||||
<!-- composants riot -->
|
||||
|
||||
<script src="app.riot" type="riot"></script>
|
||||
<script src="todo-list.riot" type="riot"></script>
|
||||
<script src="todo-nav.riot" type="riot"></script>
|
||||
<script src="todo-form.riot" type="riot"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main class="container">
|
||||
<app />
|
||||
</main>
|
||||
|
||||
<script type="module">
|
||||
|
||||
import makeDataService from "./js/api.js";
|
||||
|
||||
riot.register('router', route.Router);
|
||||
riot.register('route', route.Route);
|
||||
|
||||
riot.compile().then(async () => {
|
||||
|
||||
let sa = makeDataService();
|
||||
|
||||
riot.install(function(component){
|
||||
if (component.name === "app")
|
||||
component.serviceData = sa;
|
||||
})
|
||||
|
||||
|
||||
riot.mount('app')
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user