添加登录功能
This commit is contained in:
24
src/store/editors.ts
Normal file
24
src/store/editors.ts
Normal 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
3
src/store/modal.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { ref } from "vue";
|
||||
|
||||
export const loginModal = ref(false)
|
||||
4
src/store/user.ts
Normal file
4
src/store/user.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { computed, ref } from "vue"
|
||||
|
||||
export const username = ref("")
|
||||
export const authed = computed(() => !!username.value)
|
||||
Reference in New Issue
Block a user