Skip to content

Commit 9e3b4cf

Browse files
committed
update api and add comp
1 parent 9cfe91f commit 9e3b4cf

File tree

10 files changed

+307
-34
lines changed

10 files changed

+307
-34
lines changed

src-tauri/tauri.conf.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"title": "Roco Codex",
3737
"width": 500,
3838
"height": 600,
39-
"decorations": false
39+
"decorations": false,
40+
"visible": false
4041
}
4142
],
4243
"systemTray": {

src/App.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const slideDirection = useStorage(
2929
</div>
3030
</template>
3131

32-
<style>
32+
<style lang="postcss">
3333
html.dark {
3434
color-scheme: dark;
3535
}
@@ -38,6 +38,16 @@ html.dark {
3838
src: url("./assets/SourceHanSerifCN-VF.ttf");
3939
font-family: "SourceHanSerifCN";
4040
}
41+
42+
.custom-scrollbar::-webkit-scrollbar {
43+
@apply w-2;
44+
}
45+
.custom-scrollbar::-webkit-scrollbar-track {
46+
@apply bg-slate-200 dark:bg-slate-600;
47+
}
48+
.custom-scrollbar::-webkit-scrollbar-thumb {
49+
@apply bg-slate-400 shadow;
50+
}
4151
</style>
4252

4353
<style lang="postcss" scoped>

src/components/SpiritList.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function setupWindowParams(id: string, name: string, hash: string) {
7777
</script>
7878

7979
<template>
80-
<div class="angel-list-main">
80+
<div class="angel-list-main custom-scrollbar">
8181
<div
8282
class="angel-card"
8383
v-for="angel in listData"
@@ -139,15 +139,6 @@ function setupWindowParams(id: string, name: string, hash: string) {
139139
}
140140
</style>
141141
<style lang="postcss" scoped>
142-
.angel-list-main::-webkit-scrollbar {
143-
@apply w-2;
144-
}
145-
.angel-list-main::-webkit-scrollbar-track {
146-
@apply bg-slate-200 dark:bg-slate-600;
147-
}
148-
.angel-list-main::-webkit-scrollbar-thumb {
149-
@apply bg-slate-400 shadow;
150-
}
151142
.angel-list-main {
152143
@apply relative w-80 mt-8 h-80 flex flex-col items-center
153144
overflow-auto snap-y snap-mandatory;

src/components/TopLinks.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts" setup>
2+
import Menu from "./native/Menu.vue"
23
import { onActivated, ref } from "vue"
34
import { RouterLink } from "vue-router"
45
import { HomeIcon, QuestionMarkCircleIcon } from "@heroicons/vue/20/solid"
@@ -21,9 +22,7 @@ onActivated(() => {
2122
<QuestionMarkCircleIcon class="icon" />
2223
<span>关于</span>
2324
</RouterLink>
24-
<RouterLink draggable="false" class="link" to="/angel/04bca0fe">
25-
<span>Testing</span>
26-
</RouterLink>
25+
<Menu />
2726
</div>
2827
</template>
2928

src/components/native/Menu.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<script lang="ts" setup>
2+
import { Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/vue"
3+
</script>
4+
5+
<template>
6+
<div class="navigation-menu">
7+
<Menu as="div">
8+
<MenuButton>bbut</MenuButton>
9+
<transition
10+
enter-active-class="transition duration-100 ease-out"
11+
enter-from-class="transform scale-95 opacity-0"
12+
enter-to-class="transform scale-100 opacity-100"
13+
leave-active-class="transition duration-75 ease-in"
14+
leave-from-class="transform scale-100 opacity-100"
15+
leave-to-class="transform scale-95 opacity-0"
16+
>
17+
<MenuItems>
18+
<MenuItem>1</MenuItem>
19+
<MenuItem>2</MenuItem>
20+
</MenuItems>
21+
</transition>
22+
</Menu>
23+
</div>
24+
</template>
25+
26+
<style lang="postcss" scoped></style>

src/components/native/TitleBar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ function minimize() {
3636
appWindow.minimize()
3737
}
3838
39-
function close() {
40-
appWindow.close()
39+
async function close() {
40+
await appWindow.close()
4141
}
4242
4343
function addMoveClass(event: MouseEvent) {

src/composables/useLocal.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { nextTick } from "vue"
2+
import { appWindow } from "@tauri-apps/api/window"
3+
4+
export function nextTickToShow() {
5+
nextTick(() => {
6+
appWindow.show()
7+
})
8+
}

src/composables/useWindow.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WebviewWindow, WindowOptions } from "@tauri-apps/api/window"
1+
import { WebviewWindow, WindowOptions, getAll } from "@tauri-apps/api/window"
22

33
export class WindowCreator {
44
private label: string = "DefaultLabel"
@@ -10,6 +10,7 @@ export class WindowCreator {
1010
fullscreen: false,
1111
title: this.label,
1212
resizable: false,
13+
center: true,
1314
}
1415
private window: WebviewWindow | null = null
1516

@@ -26,9 +27,10 @@ export class WindowCreator {
2627
// webview window successfully created
2728
console.log("Window Creator Setup Success", label, options)
2829
})
29-
this.window.once("tauri://error", function (e) {
30+
this.window.once("tauri://error", async function (e) {
3031
// an error happened creating the webview window
3132
console.log("Window Creator Setup Error", e)
33+
await WebviewWindow.getByLabel(e.windowLabel)!.setFocus()
3234
})
3335
}
3436
}

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createApp } from "vue"
22
import "./styles.css"
33
import router from "./router"
44
import App from "./App.vue"
5+
import { nextTickToShow } from "./composables/useLocal"
56

67
import NProgress from "nprogress"
78
import "nprogress/nprogress.css" // nprogress样式文件
@@ -25,3 +26,4 @@ router.afterEach(() => {
2526
})
2627

2728
createApp(App).use(router).mount("#app")
29+
nextTickToShow()

0 commit comments

Comments
 (0)