Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <div id="app">
  2. <input type="number" placeholder="enter a number" v-model="n">
  3. <button type="button" @click.prevent="addToSet()">Add to Set</button>
  4. </div>
  5.  
  6. new Vue({
  7. el: "#app",
  8. data: {
  9. n: null,
  10. nSet: new Set()
  11. },
  12. methods: {
  13. addToSet: function() {
  14. this.nSet.add(this.n);
  15. console.log(this.n + ' added to Set');
  16. }
  17. },
  18. watch: {
  19. nSet: function (newVal, oldVal) {
  20. console.log(newVal);
  21. }
  22. }
  23. });
Add Comment
Please, Sign In to add comment