From 78e85b3589fdcaf77cc51f9402bdfdd91cd776c6 Mon Sep 17 00:00:00 2001 From: nanqi0622 Date: Sun, 26 Apr 2026 21:33:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ue\347\232\204\350\256\244\350\257\206.md" | 13 +++++++ ...60\346\215\256\347\273\221\345\256\232.md" | 39 +++++++++++++++++++ ...47\345\222\214\347\233\221\345\220\254.md" | 16 ++++++++ ...62\346\237\223\346\214\207\344\273\244.md" | 25 ++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 "\351\273\204\347\276\216\347\220\252/20260420-Vue\347\232\204\350\256\244\350\257\206.md" create mode 100644 "\351\273\204\347\276\216\347\220\252/20260422-vue\347\232\204\346\225\260\346\215\256\347\273\221\345\256\232.md" create mode 100644 "\351\273\204\347\276\216\347\220\252/20260423-vue\347\232\204\350\256\241\347\256\227\345\261\236\346\200\247\345\222\214\347\233\221\345\220\254.md" create mode 100644 "\351\273\204\347\276\216\347\220\252/20260424-\346\235\241\344\273\266\345\222\214\345\276\252\347\216\257\346\270\262\346\237\223\346\214\207\344\273\244.md" diff --git "a/\351\273\204\347\276\216\347\220\252/20260420-Vue\347\232\204\350\256\244\350\257\206.md" "b/\351\273\204\347\276\216\347\220\252/20260420-Vue\347\232\204\350\256\244\350\257\206.md" new file mode 100644 index 0000000..f2090f3 --- /dev/null +++ "b/\351\273\204\347\276\216\347\220\252/20260420-Vue\347\232\204\350\256\244\350\257\206.md" @@ -0,0 +1,13 @@ +# 笔记 +## Vue的认识 +- Vue的特性:Vue最重要的特性是双向数据绑定 +- Vue的包管理工具:一般用npm和yarn +## 项目的创建 +- yarn create vue(使用yarn命令创建项目) +- yarn dev(运行项目) +## 第一个Vue应用 +- 如何创建Vue应用 +- 如何运行应用 +- 如何打包应用 +- Vue的应用结构 +- 安装yarn的命令:npm i -g yarn \ No newline at end of file diff --git "a/\351\273\204\347\276\216\347\220\252/20260422-vue\347\232\204\346\225\260\346\215\256\347\273\221\345\256\232.md" "b/\351\273\204\347\276\216\347\220\252/20260422-vue\347\232\204\346\225\260\346\215\256\347\273\221\345\256\232.md" new file mode 100644 index 0000000..5837363 --- /dev/null +++ "b/\351\273\204\347\276\216\347\220\252/20260422-vue\347\232\204\346\225\260\346\215\256\347\273\221\345\256\232.md" @@ -0,0 +1,39 @@ +# 笔记 +## Vue的实例 +- 用createApp()函数创建实例,还要调用mount()方法才能渲染页面 +``` +const 实例名 = Vue.createApp( + {...}//根组件 +); +实例名.mount('#app'); +``` +## 在Vue中数据绑定有 +- 文本插值 +``` +<标签名>{{数据值}} +``` +- HTML绑定 +``` +<标签名 v-html="数据值">... +``` +- 属性绑定 +``` +<标签名 v-bind:属性名="数据值">... +``` +- 响应式数据绑定 + - Vue提供了两种:ref()和reactive() + +**ref** +``` +const 数据名=Vue.ref(数据值) +数据名.value=新值 +``` +**reactive** +``` +const 数据名=Vue.reactive(数据值) +数据名=新值 +``` +- 响应式数据的2种使用策略: + - 全程都用ref,无论是简单数据类型还是复杂数据类型 + - 简单数据类型用ref,复杂数据类型用reactive +- 在数据绑定时,能被解析的JS只能是表达式,而不能是语句 \ No newline at end of file diff --git "a/\351\273\204\347\276\216\347\220\252/20260423-vue\347\232\204\350\256\241\347\256\227\345\261\236\346\200\247\345\222\214\347\233\221\345\220\254.md" "b/\351\273\204\347\276\216\347\220\252/20260423-vue\347\232\204\350\256\241\347\256\227\345\261\236\346\200\247\345\222\214\347\233\221\345\220\254.md" new file mode 100644 index 0000000..aeb600c --- /dev/null +++ "b/\351\273\204\347\276\216\347\220\252/20260423-vue\347\232\204\350\256\241\347\256\227\345\261\236\346\200\247\345\222\214\347\233\221\345\220\254.md" @@ -0,0 +1,16 @@ +# 笔记 +## 计算属性 +- 计算属性用computed()函数 +- 用这个函数一定要用return返回函数 +- 使用computed中保裹的一个函数,并且这个函数最后返回一个值,这样的一个变量就叫计算属性 +``` +const 属性名=Vue.computed(()=>{ + return 计算后的数据 +}) +``` +## 监听器 +- 监听器用watch()函数 +``` +Vue.watch(侦听器的数据源,回调函数,可选参数) +``` +- 可选参数两个值:一是immediate一般默认值为false,二是deep一般默认值也为false \ No newline at end of file diff --git "a/\351\273\204\347\276\216\347\220\252/20260424-\346\235\241\344\273\266\345\222\214\345\276\252\347\216\257\346\270\262\346\237\223\346\214\207\344\273\244.md" "b/\351\273\204\347\276\216\347\220\252/20260424-\346\235\241\344\273\266\345\222\214\345\276\252\347\216\257\346\270\262\346\237\223\346\214\207\344\273\244.md" new file mode 100644 index 0000000..9549aae --- /dev/null +++ "b/\351\273\204\347\276\216\347\220\252/20260424-\346\235\241\344\273\266\345\222\214\345\276\252\347\216\257\346\270\262\346\237\223\346\214\207\344\273\244.md" @@ -0,0 +1,25 @@ +# 笔记 +## 认识指令 +- 内容渲染 +- 条件渲染 +- 循环渲染 +- 属性绑定:v-bind +- 事件处理 +- 表单绑定 +## 条件渲染 +- 指令包括v-if,v-else-if,v-else和v-show +``` +<标签名 v-if='条件表达式A'>... +<标签名 v-else-if='条件表达式B'>... +<标签名 v-else>... +``` +- !**注意:** + - v-else指令必须紧跟在v-if或者v-else-if依附的元素后面 + - v-else-if必须紧跟在v-if依附的元素后面 +- v-show与v-if最大的不同是:v-show是通过"display:none"样式来控制元素的隐藏和显示的 +## 循环渲染 +- 指令为v-for +``` +<标签名 v-for="(item,name,index) in items">... +``` +**在语法中,可以同时省略name和index,也可只省略index,但不可只省略name** -- Gitee