更新pinia插件的使用

This commit is contained in:
黑先森
2024-11-12 20:23:45 +08:00
parent b352d49e0b
commit 1c8314c6fa
7 changed files with 45 additions and 83 deletions
+12 -1
View File
@@ -14,7 +14,18 @@ export default defineNuxtConfig({
},
css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"],
modules: ["@element-plus/nuxt", "@pinia/nuxt", "pinia-plugin-persistedstate/nuxt", "@nuxtjs/tailwindcss"],
modules: [
"@element-plus/nuxt",
"@pinia/nuxt",
[
"pinia-plugin-persistedstate/nuxt",
{
key: "__glj_persisted_%id",
storage: "localStorage"
}
],
"@nuxtjs/tailwindcss"
],
alias: {
"@": path.resolve(__dirname, "./")
+1 -1
View File
@@ -31,7 +31,7 @@
"pinia": "^2.2.6",
"pinia-plugin-persistedstate": "^4.1.3",
"postcss": "^8.4.38",
"typescript": "^5.4.5",
"typescript": "^5.6.3",
"vue-clipboard3": "^2.0.0"
}
}
-10
View File
@@ -1,10 +0,0 @@
import { createPersistedState } from 'pinia-plugin-persistedstate'
import { defineNuxtPlugin } from "nuxt/app";
export default defineNuxtPlugin((nuxtApp: any) => {
nuxtApp.$pinia.use(
createPersistedState({
storage: localStorage,
key: id => `__glj_persisted_${id}`
})
);
});
+17 -17
View File
@@ -75,7 +75,7 @@ importers:
specifier: ^8.4.38
version: 8.4.49
typescript:
specifier: ^5.4.5
specifier: ^5.6.3
version: 5.6.3
vue-clipboard3:
specifier: ^2.0.0
@@ -2471,8 +2471,8 @@ packages:
engines: {node: '>=10'}
hasBin: true
mlly@1.7.2:
resolution: {integrity: sha512-tN3dvVHYVz4DhSXinXIk7u9syPYaJvio118uomkovAtWBT+RdbP6Lfh/5Lvo519YMmwBafwlh20IPTXIStscpA==}
mlly@1.7.3:
resolution: {integrity: sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==}
mri@1.2.0:
resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==}
@@ -4311,7 +4311,7 @@ snapshots:
jiti: 2.4.0
klona: 2.0.6
knitwork: 1.1.0
mlly: 1.7.2
mlly: 1.7.3
pathe: 1.1.2
pkg-types: 1.2.1
scule: 1.3.0
@@ -4393,7 +4393,7 @@ snapshots:
jiti: 2.4.0
knitwork: 1.1.0
magic-string: 0.30.12
mlly: 1.7.2
mlly: 1.7.3
ohash: 1.1.4
pathe: 1.1.2
perfect-debounce: 1.0.0
@@ -5182,7 +5182,7 @@ snapshots:
dotenv: 16.4.5
giget: 1.2.3
jiti: 2.4.0
mlly: 1.7.2
mlly: 1.7.3
ohash: 1.1.4
pathe: 1.1.2
perfect-debounce: 1.0.0
@@ -5668,7 +5668,7 @@ snapshots:
externality@1.0.2:
dependencies:
enhanced-resolve: 5.17.1
mlly: 1.7.2
mlly: 1.7.3
pathe: 1.1.2
ufo: 1.5.4
@@ -5932,7 +5932,7 @@ snapshots:
impound@0.2.0(rollup@4.25.0):
dependencies:
'@rollup/pluginutils': 5.1.3(rollup@4.25.0)
mlly: 1.7.2
mlly: 1.7.3
pathe: 1.1.2
unenv: 1.10.0
unplugin: 1.15.0
@@ -6178,7 +6178,7 @@ snapshots:
h3: 1.13.0
http-shutdown: 1.2.2
jiti: 2.4.0
mlly: 1.7.2
mlly: 1.7.3
node-forge: 1.3.1
pathe: 1.1.2
std-env: 3.8.0
@@ -6188,7 +6188,7 @@ snapshots:
local-pkg@0.5.0:
dependencies:
mlly: 1.7.2
mlly: 1.7.3
pkg-types: 1.2.1
lodash-es@4.17.21: {}
@@ -6313,7 +6313,7 @@ snapshots:
mkdirp@1.0.4: {}
mlly@1.7.2:
mlly@1.7.3:
dependencies:
acorn: 8.14.0
pathe: 1.1.2
@@ -6393,7 +6393,7 @@ snapshots:
magic-string: 0.30.12
magicast: 0.3.5
mime: 4.0.4
mlly: 1.7.2
mlly: 1.7.3
node-fetch-native: 1.6.4
ofetch: 1.4.1
ohash: 1.1.4
@@ -6521,7 +6521,7 @@ snapshots:
klona: 2.0.6
knitwork: 1.1.0
magic-string: 0.30.12
mlly: 1.7.2
mlly: 1.7.3
nanotar: 0.1.1
nitropack: 2.10.4(typescript@5.6.3)
nuxi: 3.15.0
@@ -6752,7 +6752,7 @@ snapshots:
pkg-types@1.2.1:
dependencies:
confbox: 0.1.8
mlly: 1.7.2
mlly: 1.7.3
pathe: 1.1.2
pluralize@8.0.0: {}
@@ -7463,7 +7463,7 @@ snapshots:
fast-glob: 3.3.2
local-pkg: 0.5.0
magic-string: 0.30.12
mlly: 1.7.2
mlly: 1.7.3
pathe: 1.1.2
pkg-types: 1.2.1
scule: 1.3.0
@@ -7486,7 +7486,7 @@ snapshots:
json5: 2.2.3
local-pkg: 0.5.0
magic-string: 0.30.12
mlly: 1.7.2
mlly: 1.7.3
pathe: 1.1.2
scule: 1.3.0
unplugin: 1.15.0
@@ -7540,7 +7540,7 @@ snapshots:
dependencies:
knitwork: 1.1.0
magic-string: 0.30.12
mlly: 1.7.2
mlly: 1.7.3
pathe: 1.1.2
pkg-types: 1.2.1
unplugin: 1.15.0
+12 -38
View File
@@ -27,51 +27,25 @@ export default defineStore("main", {
saveErrorLog: true, // 是否保存错误日志
logLevel: "error", //日志等级
devName: false, //自定义网卡名
devNameValue: "", //自定义网卡名
devNameValue: "" //自定义网卡名
},
cidrEnable: false,
basePeers: ["public.easytier.top:11010"],
theme: false, //主题 false light true dark
configStartEnable: false, //使用配置文件启动
configPath: "", //配置文件路径
cidrEnable: false,
winIpBcAutoStart: true,
winipBcPid: 0,
winipBcStart: false,
winIpBcAutoStart: true,
basePeers: ["public.easytier.top:11010"],
};
},
persist: {
paths: [
"basePeers",
"cidrEnable",
"theme",
"configStartEnable",
"configPath",
"winIpBcAutoStart",
"config.proxyNetworks",
"config.serverUrl",
"config.networkName",
"config.protocol",
"config.networkPassword",
"config.disbleP2p",
"config.autoStart",
"config.coonectAfterStart",
"config.disableIpv6",
"config.disbleListenner",
"config.disableEncryption",
"config.multiThread",
"config.enablExitNode",
"config.noTun",
"config.latencyfirst",
"config.useSmoltcp",
"config.disableUdpHolePunching",
"config.relayAllPeerrpc",
"config.hostname",
"config.ipv4",
"config.dhcp",
"config.saveErrorLog",
"config.logLevel",
"config.devName",
"config.devNameValue",
],
},
// 除了这些,其他都要存下来
omit: [
"winipBcPid",
"winipBcStart"
]
}
});
+3 -4
View File
@@ -28,17 +28,16 @@
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
// "types": ["element-plus/global"]
// "moduleResolution":"Bundler",
"resolveJsonModule": true,
// 从 Vue 3.4 开始,Vue 不再隐式注册全局 JSX 命名空间。要指示 TypeScript 使用 Vue 的 JSX 类型定义,请确保在你的 tsconfig.json 中包含以下内容
"jsx": "preserve",
"jsxImportSource": "vue",
"types": ["@pinia/nuxt", "vite/client", "element-plus/global"],
"types": ["@pinia/nuxt", "vite/client", "element-plus/global", "pinia-plugin-persistedstate"],
"allowJs": true, // 允许编译器编译JSJSX文件
"checkJs": true, // 允许在JS文件中报错,通常与allowJS一起使用
"checkJs": false, // 允许在JS文件中报错,通常与allowJS一起使用
"esModuleInterop": true, // 允许export=导出,由import from 导入
"lib": ["DOM", "ESNext"],
"allowSyntheticDefaultImports": true
}
-12
View File
@@ -1,17 +1,5 @@
import { ElMessage } from "element-plus";
import Clipboard from "vue-clipboard3";
export const ENV = import.meta.env;
export const clipBoardCopy = async (text: string) => {
const { toClipboard } = Clipboard();
try {
await toClipboard(text);
ElMessage.success("复制成功");
} catch (e) {
ElMessage.error("复制失败");
}
};
//防抖
export const bounce = (time = 3000) => {