From 9a1cf9dd5352d2ddd85ba7d9a8fbaefd0c5c470c Mon Sep 17 00:00:00 2001 From: heixinyouzi <2410633923@qq.com> Date: Thu, 7 Nov 2024 14:56:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 3 +- src/stores/index.js | 12 ++++ src/stores/size.js | 6 +- src/views/home/index.vue | 2 +- src/views/home/navMenu.vue | 111 ++++++++++++++++++++++++++----------- src/views/home/search.vue | 8 ++- src/views/home/side.vue | 22 +++++--- 7 files changed, 121 insertions(+), 43 deletions(-) create mode 100644 src/stores/index.js diff --git a/src/main.js b/src/main.js index 395a3b9..365cfe3 100644 --- a/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ import { createApp } from "vue"; import http from '@/api/index.js'; import icon from "@/icon/index.js"; +import store from "@/stores/index.js"; import "@wangeditor/editor/dist/css/style.css"; // 引入 css import "qweather-icons/font/qweather-icons.css"; import "tailwindcss/tailwind.css"; @@ -24,7 +25,7 @@ document.oncontextmenu = function () { app.use(createPinia()); app.use(router).use(VueWechatTitle); - +window.$store = store window.$http = http // window.$icon = icon for (const key in icon) { diff --git a/src/stores/index.js b/src/stores/index.js new file mode 100644 index 0000000..413979f --- /dev/null +++ b/src/stores/index.js @@ -0,0 +1,12 @@ +const files = import.meta.glob('./*.js', { + eager: true, +}) + +const store = {} +// console.log("stores封装",files); +for (const i in files) { + const t = i.split("/") + const name = t[1].split(".")[0] + store[name] = files[i] +} +export default store \ No newline at end of file diff --git a/src/stores/size.js b/src/stores/size.js index eb6431e..fa5b4ee 100644 --- a/src/stores/size.js +++ b/src/stores/size.js @@ -6,6 +6,7 @@ export const usesizeStore = defineStore("size", { navH: 0, conH: 0, footH:0, + searchH:0, }), actions: { setMenuH(v) { @@ -17,7 +18,10 @@ export const usesizeStore = defineStore("size", { setFootH(v){ this.footH = v; }, - + setSearchH(v){ + this.searchH = v; + }, + setX(v){ this.x = v; } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index abfcbb4..129f613 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,6 +1,6 @@