💾 Archived View for gmi.noulin.net › gitRepositories › moonjsExamples › file › twoWayBinding.html.gm… captured on 2024-07-09 at 02:34:14. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

moonjsExamples

Log

Files

Refs

README

twoWayBinding.html (638B)

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