diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 9e28cff..84c7e7c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -4,7 +4,7 @@ "version": "0.1.0", "identifier": "cn.nopj.ittools", "build": { - "frontendDist": "../src", + "frontendDist": "../build", "devUrl": "http://localhost:5173", "beforeDevCommand": "npm run dev", "beforeBuildCommand": "npm run build" @@ -17,7 +17,9 @@ "height": 600, "resizable": true, "fullscreen": false, - "decorations": false + "decorations": false, + "minWidth": 400 , + "minHeight": 300 } ], "security": { diff --git a/src/app.css b/src/app.css index 5a491d0..11b0f61 100644 --- a/src/app.css +++ b/src/app.css @@ -1,10 +1,9 @@ @import 'tailwindcss'; -:global(body) { - +body { background-color: #1f1f1f; /* 示例:一个深灰色 */ - min-height: 100vh; - min-width: 100vw; - margin: 0; /* 移除浏览器默认的 body 边距 */ + + margin: 0; + color: white; } \ No newline at end of file diff --git a/src/lib/assets/icon/close.svg b/src/lib/assets/icon/close.svg deleted file mode 100644 index 1128373..0000000 --- a/src/lib/assets/icon/close.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/lib/assets/icon/sprite.svg b/src/lib/assets/icon/sprite.svg new file mode 100644 index 0000000..ac6d7ec --- /dev/null +++ b/src/lib/assets/icon/sprite.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/lib/components/layout/Header.svelte b/src/lib/components/layout/Header.svelte index 502d151..204e479 100644 --- a/src/lib/components/layout/Header.svelte +++ b/src/lib/components/layout/Header.svelte @@ -1,48 +1,40 @@
- 🎉 我的Tauri Svelte应用 +
- - - + + +
diff --git a/src/lib/utils/persistedStroeUtil.ts b/src/lib/utils/persistedStroeUtil.ts new file mode 100644 index 0000000..02a65f0 --- /dev/null +++ b/src/lib/utils/persistedStroeUtil.ts @@ -0,0 +1,23 @@ +import {writable,type Writable} from 'svelte/store'; + +export function persistedStore (key: string, initialValue: T): Writable { + let storedValue: T; + try { + const json = localStorage.getItem(key); + storedValue = json ? JSON.parse(json) : initialValue; + } catch (e) { + console.warn(`读取 localStorage key = ${key} 失败`, e); + storedValue = initialValue; + } + const store = writable(storedValue); + + store.subscribe(value => { + try { + localStorage.setItem(key, JSON.stringify(value)); + } catch (e) { + console.warn(`写入 localStorage key=${key} 失败`, e); + } + }); + + return store; +} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 7fa16b9..c08f1ea 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,12 +1,16 @@ -
-

112323{title}

-

{description}

+
+ +
    + +
  • goto('/about')}>关于
  • +
\ No newline at end of file diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte new file mode 100644 index 0000000..e721cd4 --- /dev/null +++ b/src/routes/about/+page.svelte @@ -0,0 +1,7 @@ + + +
    +
  • goto('/')}>首页
  • +
\ No newline at end of file