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 0000000000000000000000000000000000000000..a23617e55804ce4918b19090a13e622d1eb78e1a --- /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 0000000000000000000000000000000000000000..f832d4366fa1dfc87ed7b3a524eb6374bcb1fde5 --- /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 0000000000000000000000000000000000000000..f12ec1c3a48b9e0f754df1c47fc320660114bef8 --- /dev/null +++ "b/\346\236\227\347\216\211\346\225\217/20240516_curd.md" @@ -0,0 +1,187 @@ +# Home.vue +```js + + + + + +``` + +# 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