From 3a23e93aab18734a96c37536b92adcc076088eb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E7=8E=89=E6=95=8Fa?= <2647486093@qq.com>
Date: Sun, 19 May 2024 12:45:12 +0800
Subject: [PATCH] vue
---
...32\347\224\250\347\273\204\344\273\266.md" | 1 +
.../20240514_pinia.md" | 37 ++++
.../20240516_curd.md" | 187 ++++++++++++++++++
3 files changed, 225 insertions(+)
create mode 100644 "\346\236\227\347\216\211\346\225\217/20240513_\351\200\232\347\224\250\347\273\204\344\273\266.md"
create mode 100644 "\346\236\227\347\216\211\346\225\217/20240514_pinia.md"
create mode 100644 "\346\236\227\347\216\211\346\225\217/20240516_curd.md"
diff --git "a/\346\236\227\347\216\211\346\225\217/20240513_\351\200\232\347\224\250\347\273\204\344\273\266.md" "b/\346\236\227\347\216\211\346\225\217/20240513_\351\200\232\347\224\250\347\273\204\344\273\266.md"
new file mode 100644
index 0000000..a23617e
--- /dev/null
+++ "b/\346\236\227\347\216\211\346\225\217/20240513_\351\200\232\347\224\250\347\273\204\344\273\266.md"
@@ -0,0 +1 @@
+# 上传头像
\ No newline at end of file
diff --git "a/\346\236\227\347\216\211\346\225\217/20240514_pinia.md" "b/\346\236\227\347\216\211\346\225\217/20240514_pinia.md"
new file mode 100644
index 0000000..f832d43
--- /dev/null
+++ "b/\346\236\227\347\216\211\346\225\217/20240514_pinia.md"
@@ -0,0 +1,37 @@
+# pinia
+下载:`npm i pinia`
+
+```js
+
+// mian.ts
+import {createPinia} from 'pinia'
+const pinia=createPinia()
+app.use(pinia)
+
+// 定义store文件夹,count.ts【conponent文件夹Count.vue】
+// count.ts
+export const useCountStore=defineStore('count',{
+ // 方法
+ action:{
+ btnAdd(val:number){this.num+=val}
+ },
+ // 数据
+ state(){
+ return {num:1}
+ },
+ // 数据进一步处理
+ getters:{
+ bigNum:state=>state.num*10,
+ setInt():number {return this.num+1}
+ }
+})
+
+// Count.vue
+import {useCountStore} from '....'
+
+const countStore=useCountStore()
+countStore.num===1
+
+let {num,bigNum,setInt,btnAdd}=storeToRefs(countStore)
+num===1
+```
\ No newline at end of file
diff --git "a/\346\236\227\347\216\211\346\225\217/20240516_curd.md" "b/\346\236\227\347\216\211\346\225\217/20240516_curd.md"
new file mode 100644
index 0000000..f12ec1c
--- /dev/null
+++ "b/\346\236\227\347\216\211\346\225\217/20240516_curd.md"
@@ -0,0 +1,187 @@
+# Home.vue
+```js
+
+
+
+
+
+
+
+ 添加
+
+
+
+ | 序号 |
+ 标题 |
+ 作者 |
+ 内容 |
+ 操作 |
+
+
+
+
+ | {{ index + 1 }} |
+ {{ item.title }} |
+ {{ item.author }} |
+ {{ item.content }} |
+
+ 编辑
+ 删除
+ |
+
+
+
+
+
+
+```
+
+# Edit.vue
+```js
+
+
+
+
+
+
+
+
+```
+
+# router index.ts
+```js
+import { createRouter, createWebHashHistory } from "vue-router";
+
+const router = createRouter({
+ history: createWebHashHistory(),
+ routes: [
+ {
+ path: "/home",
+ name: "home",
+ component: () => import('../pages/Home.vue')
+ },
+ {
+ path: "/edit/:id?",
+ name: "edit",
+ component: () => import('../pages/Edit.vue')
+ },
+ {
+ path: "/",
+ redirect: '/home'
+ }
+ ]
+})
+
+export default router
+```
\ No newline at end of file
--
Gitee