
<!DOCtype html> <HTML> <head> <meta charset="UTF-8"> <title>Title</title> <script src="../JS/vue.js"></script> </head> <body> <div id="APP"> <h3>当前计数器:{{counter}}</h3> <button @click="add">+</button> <button @click="minutes">-</button> </div> <script> const app = new vue({ el: "#App", data: { counter: 0 }, methods: { add: function () { this.counter++; }, minutes: function () { this.counter--; } } }) </script> </body> </html>
试试吧。



网友评论文明上网理性发言 已有0人参与
发表评论: