28_checkbox.html 677 B

12345678910111213141516171819202122232425262728
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <script src="./js/vue.js"></script>
  8. </head>
  9. <body>
  10. <div id="app">
  11. <input type="checkbox" v-bind:checked="isCheck">
  12. <button @click="checkFun" >check</button>
  13. </div>
  14. <script>
  15. var app = new Vue({
  16. el: '#app',
  17. data: {
  18. isCheck: false
  19. },
  20. methods: {
  21. checkFun: function(){
  22. this.isCheck = !this.isCheck;
  23. }
  24. },
  25. })
  26. </script>
  27. </body>
  28. </html>