refactor: load and save settings from a single object
This commit is contained in:
parent
cd1f294600
commit
5b4c278b83
4 changed files with 49 additions and 13 deletions
18
app.vue
18
app.vue
|
@ -8,6 +8,7 @@
|
|||
<script lang="ts" setup>
|
||||
import ContextMenu from '~/components/ContextMenu.vue';
|
||||
import { render } from 'vue';
|
||||
import settingLoad from './utils/settingLoad';
|
||||
|
||||
const banner = useState("banner", () => false);
|
||||
|
||||
|
@ -43,21 +44,14 @@ function contextMenuHandler(e: MouseEvent) {
|
|||
//]);
|
||||
}
|
||||
|
||||
let currentTheme = "dark" // default theme
|
||||
const savedTheme = localStorage.getItem("selectedTheme");
|
||||
if (savedTheme) {
|
||||
currentTheme = savedTheme;
|
||||
}
|
||||
|
||||
const currentTheme = settingLoad("selectedThemeUrl") ?? "dark"
|
||||
const baseURL = useRuntimeConfig().app.baseURL;
|
||||
|
||||
useHead({
|
||||
link: [
|
||||
{
|
||||
rel: "stylesheet",
|
||||
href: `${baseURL}themes/${currentTheme}.css`
|
||||
}
|
||||
]
|
||||
link: [{
|
||||
rel: "stylesheet",
|
||||
href: `${baseURL}themes/${currentTheme}.css`
|
||||
}]
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue