fengchuanyu 3 months ago
parent
commit
e6de30f06d
1 changed files with 30 additions and 0 deletions
  1. 30 0
      11_Vue基础/练习1_累加器.html

+ 30 - 0
11_Vue基础/练习1_累加器.html

@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <script src="./js/vue.js"></script>
+</head>
+<body>
+    <div id="app">
+        <h1 v-if="num <= 10">{{num}}</h1>
+        <h1 v-else>已经为最大值了</h1>
+        <button @click="addFun">add</button>
+    </div>
+    <!-- <div>{{num}}</div> -->
+    <script>
+        let app = new Vue({
+            el: '#app',
+            data:{
+                num:0
+            },
+            methods: {
+                addFun:function(){
+                    this.num++
+                }
+            },
+        })
+    </script>
+</body>
+</html>