From c731ae7ca67f8a6a9ecce4c33901931971e585b2 Mon Sep 17 00:00:00 2001 From: lhx <781131860@qq.com> Date: Sat, 29 May 2021 17:32:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BB=8A=E5=A4=A9=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E5=B0=8F=E7=82=B9=E7=AC=94=E8=AE=B0=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../note2021-5-29-01.md" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" diff --git "a/\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" "b/\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" new file mode 100644 index 0000000..0cad1b6 --- /dev/null +++ "b/\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" @@ -0,0 +1,60 @@ +# Vue的第四课 + +## 模板语法 + +### 文本 + +通过使用 v-once 指令,你也能执行一次性地插值,当数据改变时,插值处的内容不会更新。但请留心这会影响到该节点上的其它数据绑定 + +例子: + +
+ Message:{{msg}} + 这个将不会改变: {{ msg }} +
+ + + + + +结果:当你插入app.msg='游海水哦'是 + 是这样: + + Message:游海水哦 这个将不会改变: 6060 + + +### 原始 HTML +双大括号会将数据解释为普通文本,而非 HTML 代码。为了输出真正的 HTML,你需要使用 v-html + +
+

Using mustaches: {{ rawHtml }}

+

Using v-html directive:

+
+ + + +输出是这样的: + + Using mustaches:

我的世界

+ + Using v-html directive: + + 我的世界 \ No newline at end of file -- Gitee From 2a54417bb7823bbdc23ca00911bbadf6203c4c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cglinhongxin?= <781131860@qq.com> Date: Sat, 29 May 2021 21:57:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=8A=E6=97=A5=E7=AC=94=E8=AE=B0?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../note2021-5-29-01.md" | 212 +++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-) diff --git "a/\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" "b/\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" index 0cad1b6..48948da 100644 --- "a/\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" +++ "b/\346\236\227\351\270\277\351\221\253/note2021-5-29-01.md" @@ -1,4 +1,4 @@ -# Vue的第四课 +# Vue的第四次课 ## 模板语法 @@ -57,4 +57,212 @@ Using v-html directive: - 我的世界 \ No newline at end of file + 我的世界 + + +### Attribute + +Mustache 语法不能作用在 HTML attribute 上,遇到这种情况应该使用 v-bind: + + div v-bind:id="dynamicId"> + +对于布尔 attribute (它们只要存在就意味着值为 true),v-bind 工作起来略有不同,在这个例子中: + +
+ + +
+ + + + +如果 isButtonDisabled 的值是 null、undefined 或 false,则 disabled attribute 甚至不会被包含在渲染出来的