添加登录功能

This commit is contained in:
2025-02-28 16:20:58 +08:00
parent 81706fc48d
commit 28abe1b429
13 changed files with 181 additions and 14 deletions

24
src/store/editors.ts Normal file
View File

@@ -0,0 +1,24 @@
import { useStorage } from "@vueuse/core"
const defaultHTML = `<div class="welcome">黄岩一职</div>`
const defaultCSS = `.welcome {
color: red;
font-size: 24px;
}`
export const html = useStorage("web-html", defaultHTML)
export const css = useStorage("web-css", defaultCSS)
export const js = useStorage("web-js", "")
export const tab = useStorage("web-tab", "html")
export const size = useStorage("web-fontsize", 24)
export function reset(lang: "html" | "css" | "js") {
if (lang === "html") {
html.value = defaultHTML
} else if (lang === "css") {
css.value = defaultCSS
} else {
js.value = ""
}
}

3
src/store/modal.ts Normal file
View File

@@ -0,0 +1,3 @@
import { ref } from "vue";
export const loginModal = ref(false)

4
src/store/user.ts Normal file
View File

@@ -0,0 +1,4 @@
import { computed, ref } from "vue"
export const username = ref("")
export const authed = computed(() => !!username.value)