diff --git "a/\350\226\233\346\231\250\350\276\276/2021-05-25.md" "b/\350\226\233\346\231\250\350\276\276/2021-05-25.md" new file mode 100644 index 0000000000000000000000000000000000000000..27cf87ca9a22bcb7b8b68252c52978f5d12cdd08 --- /dev/null +++ "b/\350\226\233\346\231\250\350\276\276/2021-05-25.md" @@ -0,0 +1,60 @@ +# 什么是Vue +通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件 + +如果不使用 Vue, 那么就会用到 JS 或者 JQuery,通过操作 HTML DOM 的方式,把数据显示上去。 + +如果使用Vue, 那么仅仅需要提供数据,以及数据要绑定到的元素的id,就行了,不需要显式地操作HTML DOM。 + +# 我的第一个Vue应用 +``` +
+

来打个招呼吧:

+

{{message}}

+
+ + + + +``` +![image](images/2021-05-25/1.png) + +在控制台输入 app.message 可修改message的值,如下: +![image](images/2021-05-25/2.png) +![image](images/2021-05-25/3.png) + +# Vue.js模板语法 +## 插值 +### 文本 +数据绑定最常见的形式就是使用 {{...}}(双大括号)的文本插值: + +``` +
+

{{ message }}

+
+``` +### Html +使用 v-html 指令用于输出 html 代码: +``` +
+
+
+ + + + +``` +![image](images/2021-05-25/4.png) \ No newline at end of file diff --git "a/\350\226\233\346\231\250\350\276\276/2021-05-26.md" "b/\350\226\233\346\231\250\350\276\276/2021-05-26.md" new file mode 100644 index 0000000000000000000000000000000000000000..013c8c4d9066db66cfeb7dfecd3a9e44d71ecbf5 --- /dev/null +++ "b/\350\226\233\346\231\250\350\276\276/2021-05-26.md" @@ -0,0 +1,79 @@ +# 条件与循环 +控制切换一个元素是否显示也相当简单: + +``` +
+

我在这里!

+
+ + + + + +``` +![image](images/2021-05-26/1.png) + +在控制台输入 app.msg = false ,之前显示的消息就消失了。 +
+ +v-for 指令可以绑定数组的数据来渲染一个项目列表: + +``` +
+
    +
  1. {{item.name}}
  2. +
+
+ + + + +``` + +![image](images/2021-05-26/2.png) + +在控制台里,输入 app.user.push({ name: '李白' }),列表最后添加了一个李白。 + +![image](images/2021-05-26/3.png) +![image](images/2021-05-26/4.png) + +v-model 指令,能轻松实现表单输入和应用状态之间的双向绑定。 + +``` +
+

{{ message }}

+ +
+ + + + +``` + +![image](images/2021-05-26/5.png) +![image](images/2021-05-26/6.png) \ No newline at end of file diff --git "a/\350\226\233\346\231\250\350\276\276/2021-05-28.md" "b/\350\226\233\346\231\250\350\276\276/2021-05-28.md" new file mode 100644 index 0000000000000000000000000000000000000000..7cd10324bd41d7f064dcf24cacc882cb5477b59f --- /dev/null +++ "b/\350\226\233\346\231\250\350\276\276/2021-05-28.md" @@ -0,0 +1,76 @@ +# 数据与方法 +当一个 Vue 实例被创建时,它将 data 对象中的所有的 property 加入到 Vue 的响应式系统中。当这些 property 的值发生改变时,视图将会产生“响应”,即匹配更新为新的值。 + +``` +
+

+ {{people.name}}的年龄为:{{people.age}} +

+
+ + + + +``` +![image](images/2021-05-28/1.png) + +# 实例生命周期钩子 +``` +
+

+ {{people.name}}的年龄为:{{people.age}} + +

+

{{user()}}

+
+ + + + +``` +![image](images/2021-05-28/2.png) \ No newline at end of file diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-25/1.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/1.png" new file mode 100644 index 0000000000000000000000000000000000000000..fcff841bea312fabda26ee3c350b35bfe2fc3cae Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/1.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-25/2.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/2.png" new file mode 100644 index 0000000000000000000000000000000000000000..3264bd76b7c1670285ace1ce1176314b57bcb9ef Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/2.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-25/3.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/3.png" new file mode 100644 index 0000000000000000000000000000000000000000..bbca74cad5b69be5f69b5a767f5b13645b8f57a6 Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/3.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-25/4.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/4.png" new file mode 100644 index 0000000000000000000000000000000000000000..15ba87cafa3d669eb94f05529b340087863ae4fc Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-25/4.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-26/1.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/1.png" new file mode 100644 index 0000000000000000000000000000000000000000..d1979ec306bc963366362f4858d52c8cae3e1789 Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/1.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-26/2.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/2.png" new file mode 100644 index 0000000000000000000000000000000000000000..297bfd99c062cf6ad755fcc34e2fad370bc6441f Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/2.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-26/3.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/3.png" new file mode 100644 index 0000000000000000000000000000000000000000..a6286828a78f1e0f712bd3c0b3d78322dc8f55a4 Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/3.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-26/4.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/4.png" new file mode 100644 index 0000000000000000000000000000000000000000..ff3ecb125ffbf7a9fe74035788d12226472789fd Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/4.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-26/5.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/5.png" new file mode 100644 index 0000000000000000000000000000000000000000..466a12193084c5d312d9f4a4b44f1a3b36a43ec6 Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/5.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-26/6.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/6.png" new file mode 100644 index 0000000000000000000000000000000000000000..33abe497c1c156293ad9478afbe6afa908f1b317 Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-26/6.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-28/1.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-28/1.png" new file mode 100644 index 0000000000000000000000000000000000000000..7137242a52408402d6f2d84b3f170a9d16f27a89 Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-28/1.png" differ diff --git "a/\350\226\233\346\231\250\350\276\276/images/2021-05-28/2.png" "b/\350\226\233\346\231\250\350\276\276/images/2021-05-28/2.png" new file mode 100644 index 0000000000000000000000000000000000000000..30576c64b80acc38cadf787992eb5c204e7335c6 Binary files /dev/null and "b/\350\226\233\346\231\250\350\276\276/images/2021-05-28/2.png" differ