<!-- fichier index.html -->

<!DOCTYPE html>
<html lang="fr">
  <head><title>index.html</title></head>
  <body>
    <div id="app">
        <span>{{ nomComplet }}</span>
    </div>
    <!-- chargement de la librairie Vue.js -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
      let vm = new Vue({
        el: "#app",
        data: {
          prenom: "Julien",
          nom: "Durand",
          nomComplet: 'Julien Durand',
        },
        watch: {
          prenom(newVal) {
            this.nomComplet = newVal + ' ' + this.nom;
          },
          nom(newVal) {
            this.nomComplet = this.prenom + ' ' + newVal;
          }
        }
      });
    </script>
  </body>
</html>
