diff --git "a/\345\260\271\345\260\221\347\232\207/note 2021-06-04.md" "b/\345\260\271\345\260\221\347\232\207/note 2021-06-04.md" new file mode 100644 index 0000000000000000000000000000000000000000..dbd8e117dc67614ba9c8d186a59d6ad6a14eda8e --- /dev/null +++ "b/\345\260\271\345\260\221\347\232\207/note 2021-06-04.md" @@ -0,0 +1,69 @@ +# 课堂笔记_07 +## Vue的学习(第七次课) +### Vue事件处理: v-on指令监听DOM事件(可以直接处理一些简单逻辑) +### 较为复杂的逻辑可以在Vue实例中定义方法由v-on接收 +``` + +``` +``` + +``` +``` +data: { + number: 0, + con: 0, +}, + +TAL: function () { + alert('现在的天赋为' + this.number + '点') +}, +``` +### 内联处理器中的方法 +``` +//在内联JS语句中调用方法 + + +Tc: function (item) { + alert(item) +}, + +//通过这个方法可以查看原生事件 +Event: function (event) { + console.log(event); +}, +``` +### 事件修饰符:可以处理DOM事件的细节,是由点开头的指令后缀来表示的 +### 如:".stop",".prevent",".capture",".self",".once",".passive" +### ".stop"可阻止单机事件继续传播,如下:不加".stop"修饰符则单击按钮“other”会弹出“other”和“阻止单击事件继续传播” +### 加上".stop"则只弹出“other” + +``` +
+ +
+ +warn: function () { + alert('阻止单击事件继续传播'); +}, +otherwarn: function () { + alert('other') +}, +``` +### ".prevent"会阻止默认行为如阻止超链接的跳转".passive"会告诉浏览器你不想阻止事件的默认行为。要把 .passive 和 .prevent 一起使用.prevent 将会被忽略 +``` +黄泉路 + +ATK: function () { + alert('现在的攻击力为' + this.con + '点') +}, +``` +### 按键修饰符 按键码:".enter",".tab"单击之后按下“回车键”,“Tab建”会触发单击事件,keyup +``` + + +Add: function () { + return this.number += 1 +}, +``` +### 系统修饰键 ".ctrl",".alt",".shift" 如单击事件@click.ctrl要按住Ctrl键然后单击才会触发事件 +### 按键码点后跟数字是ASCLL码转换形式 diff --git "a/\345\260\271\345\260\221\347\232\207/note 2021-06-05.md" "b/\345\260\271\345\260\221\347\232\207/note 2021-06-05.md" new file mode 100644 index 0000000000000000000000000000000000000000..2c0fc1af803ea6b75adfea71b9c2111b0783930b --- /dev/null +++ "b/\345\260\271\345\260\221\347\232\207/note 2021-06-05.md" @@ -0,0 +1,64 @@ +# 课堂笔记_08 +## Vue的学习(第八次课) +### 表单输入绑定v-model +### v-mdoel指令在表单元素上创建双向数据绑定 +### 但是v-model会忽略表单元素的初始值总是以Vue实例的数据作为数据来源,使用v-model要在data中声明初始值 +``` +来看看:{{da}} +``` +``` +data:{ + da:'默认', +}, +methods:{ + //input事件绑定的方法,能在网页后台控制台看到效果 + daLog:function(){ + console.log(this.da); + }, +} +``` +### 多选框checkbox和单选框radio,他们的表单元素初始值为checked最后通过对value的绑定来确定默认值 +``` +//循环打印: +
+ {{item.acName}} +
+ +
+ {{item.sName}} +
+``` +``` +data:{ + de:'现在', + ssr:[ + { + id:1, + sName:'过去', + }, + { + id:2, + sName:'现在', + }, + { + id:3, + sName:'未来', + }, + ], +}, + +``` +### 选择框如果 v-model 表达式的初始值未能匹配任何选项, + + + + +``` +``` +seLog:function(){ + console.log(this.df); +} +``` \ No newline at end of file