moonjsExamples

moonjs example (from tutorial)
git clone https://noulin.net/git/moonjsExamples.git
Log | Files | Refs | README

showHide.html (537B)


      1 <body>
      2 <script src="https://unpkg.com/moonjs"></script>
      3 <div id="app">
      4   <p>{{count}}</p>
      5   <button m-on:click="increment">Increment</button>
      6   <button m-on:click="reset">Reset</button>
      7   <div m-if="count !==0">
      8   Count is not 0.
      9   </div>
     10 </div>
     11 <script>
     12 const app7 = new Moon({
     13   el: "#app",
     14   data: {
     15     count: 0
     16   },
     17   methods: {
     18     increment: function() {
     19       // Increment the count by one
     20       this.set('count', this.get('count') + 1);
     21     },
     22     reset: function() {
     23       this.set('count', 0);
     24     }
     25   }
     26 });
     27 </script>
     28 </body>