mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-13 21:13:09 +00:00
### New features - New face + dark mode - [Change font to vazirmatn](057f3190de) - [use customized andtv](f956009fd2) - [popConfirm for del and reset client](66c98e8392) - [Separate page for xray config](9e1cd6315f) - Separate face for mobile view - [Show online users](bf892e9965) [#559](https://github.com/alireza0/x-ui/issues/559) - [Auto renew](96408967ae) ### Bug fixes - [[tgbot] Retry loop on start](211c05ec29) - [fix docker-compose version](1dcec91ce4) - [fix redirect after restart](81d25a032c)
34 lines
900 B
HTML
34 lines
900 B
HTML
{{define "component/themeSwitchTemplate"}}
|
|
<template>
|
|
<a-switch size="small" :default-checked="themeSwitcher.isDarkTheme"
|
|
@change="themeSwitcher.toggleTheme()">
|
|
</a-switch>
|
|
</template>
|
|
{{end}}
|
|
|
|
{{define "component/themeSwitcher"}}
|
|
<script>
|
|
function createThemeSwitcher() {
|
|
const isDarkTheme = localStorage.getItem('dark-mode') === 'true';
|
|
const theme = isDarkTheme ? 'dark' : 'light';
|
|
return {
|
|
isDarkTheme,
|
|
get currentTheme() {
|
|
return this.isDarkTheme ? 'dark' : 'light';
|
|
},
|
|
toggleTheme() {
|
|
this.isDarkTheme = !this.isDarkTheme;
|
|
localStorage.setItem('dark-mode', this.isDarkTheme);
|
|
},
|
|
};
|
|
}
|
|
|
|
const themeSwitcher = createThemeSwitcher();
|
|
|
|
Vue.component('theme-switch', {
|
|
props: [],
|
|
template: `{{template "component/themeSwitchTemplate"}}`,
|
|
data: () => ({ themeSwitcher }),
|
|
});
|
|
</script>
|
|
{{end}} |