<!-- fichier index.html -->

<!DOCTYPE html>
<html lang="fr">
  <head><title>index.html</title></head>
  <body>
    <div id="app">
        <span>{{ heureCourante() }}</span>
    </div>
    <!-- chargement de la librairie Vue.js -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
      const app = new Vue({
        el: "#app",
        created() {
          setInterval(() => this.$forceUpdate(), 1000);
        },
        methods: {
          heureCourante() {
            const now = new Date();
            const heure   = ('0'+now.getHours()).slice(-2);
            const minute  = ('0'+now.getMinutes()).slice(-2);
            const seconde = ('0'+now.getSeconds()).slice(-2);
            return strDate = `${heure}h${minute} et ${seconde}s`;
          }  
        },
      });
    </script>
  </body>
</html>
