fix: 修复外观设置bug

This commit is contained in:
wangdan-fit2cloud 2024-07-16 18:50:44 +08:00
parent 6e251e6a10
commit e3b9db6847
2 changed files with 4 additions and 5 deletions

View File

@ -92,8 +92,7 @@ const useUserStore = defineStore({
async theme() { async theme() {
return await ThemeApi.getThemeInfo().then((ok) => { return await ThemeApi.getThemeInfo().then((ok) => {
this.themeInfo = ok.data this.setTheme(ok.data)
changeTheme(this.themeInfo['theme'])
window.document.title = this.themeInfo['title'] || 'MaxKB' window.document.title = this.themeInfo['title'] || 'MaxKB'
const link = document.querySelector('link[rel="icon"]') as any const link = document.querySelector('link[rel="icon"]') as any
if (link) { if (link) {
@ -103,9 +102,9 @@ const useUserStore = defineStore({
}, },
async profile() { async profile() {
return UserApi.profile().then((ok) => { return UserApi.profile().then(async (ok) => {
this.userInfo = ok.data this.userInfo = ok.data
this.theme() await this.theme()
return this.asyncGetProfile() return this.asyncGetProfile()
}) })
}, },

View File

@ -131,7 +131,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, onMounted, computed, watch } from 'vue' import { ref, reactive, onMounted, computed, watch, nextTick } from 'vue'
import { onBeforeRouteLeave } from 'vue-router' import { onBeforeRouteLeave } from 'vue-router'
import type { FormInstance, FormRules, UploadFiles } from 'element-plus' import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'