|
|
@@ -0,0 +1,34 @@
|
|
|
+<!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>
|
|
|
+ <!-- 所有的vue代码必须写在挂载点内 -->
|
|
|
+ <div id="app">
|
|
|
+ <h1 v-if="count <= 10"> 当前数字为: {{count}}</h1>
|
|
|
+ <h1 v-else> 当前为最大数值</h1>
|
|
|
+ <button @click="addFun">增加</button>
|
|
|
+ </div>
|
|
|
+ <script>
|
|
|
+ // new Vue 实例化 Vue 实例
|
|
|
+ new Vue({
|
|
|
+ // 挂载元素
|
|
|
+ el:"#app",
|
|
|
+ // data 放置数据 所有需要展示在页面中的数据
|
|
|
+ data:{
|
|
|
+ count:0
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ addFun(){
|
|
|
+ // this.count = this.count + 1
|
|
|
+ this.count++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|