fix(layout): 🐛 修复侧边栏顶部空白块颜色和无法缩小主页面问题

This commit is contained in:
nongyehong 2024-10-21 00:12:02 +08:00
parent 96ad89c05d
commit 1999f30b0e
13 changed files with 8 additions and 43 deletions

View File

@ -281,7 +281,7 @@ export enum PluginEnum {
/** 菜单显示模式 */ /** 菜单显示模式 */
export enum ShowModeEnum { export enum ShowModeEnum {
/** 图标方式 */ /** 图标方式 */
ICON = 0, ICON,
/** 文字方式 */ /** 文字方式 */
TEXT TEXT
} }

View File

@ -311,6 +311,7 @@ const handleResize = async (e: Event) => {
const initWindowHeight = async () => { const initWindowHeight = async () => {
let homeWindow = await WebviewWindow.getByLabel('home') let homeWindow = await WebviewWindow.getByLabel('home')
await homeWindow?.setResizable(true)
let size = await homeWindow?.size() let size = await homeWindow?.size()
let sf = await homeWindow?.scaleFactor() let sf = await homeWindow?.scaleFactor()
if (homeWindow && size && sf) { if (homeWindow && size && sf) {
@ -350,32 +351,6 @@ onMounted(() => {
setTimeout(() => { setTimeout(() => {
tipShow.value = false tipShow.value = false
}, 5000) }, 5000)
// // ResizeObserver headerRef
// const resizeObserver = new ResizeObserver((entries) => {
// for (let entry of entries) {
// console.log(entry.contentRect.height)
// // if (entry.contentRect.height > 220) {
// // //
// // const itemsToMove = Math.floor(itemsTop.value.length / 2) //
// // excessItems.value = itemsTop.value.splice(-itemsToMove, itemsToMove)
// // }
// }
// })
//
// // headerRef
// if (headerRef.value) {
// resizeObserver.observe(headerRef.value)
// }
//
// if (actionListRef.value) {
// resizeObserver.observe(actionListRef.value)
// }
//
// //
// onUnmounted(() => {
// resizeObserver.disconnect()
// })
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -146,7 +146,6 @@ import { MittEnum, PluginEnum } from '@/enums'
import { pluginsList } from '@/layout/left/config.tsx' import { pluginsList } from '@/layout/left/config.tsx'
import { useSettingStore } from '@/stores/setting.ts' import { useSettingStore } from '@/stores/setting.ts'
import { usePluginsStore } from '@/stores/plugins.ts' import { usePluginsStore } from '@/stores/plugins.ts'
import { STO } from '@/typings/stores'
import Mitt from '@/utils/Bus' import Mitt from '@/utils/Bus'
const settingStore = useSettingStore() const settingStore = useSettingStore()

View File

@ -127,7 +127,6 @@
import { MittEnum, PluginEnum } from '@/enums' import { MittEnum, PluginEnum } from '@/enums'
import { pluginsList } from '@/layout/left/config.tsx' import { pluginsList } from '@/layout/left/config.tsx'
import { usePluginsStore } from '@/stores/plugins.ts' import { usePluginsStore } from '@/stores/plugins.ts'
import { STO } from '@/typings/stores'
import Mitt from '@/utils/Bus' import Mitt from '@/utils/Bus'
const pluginsStore = usePluginsStore() const pluginsStore = usePluginsStore()

View File

@ -2,7 +2,6 @@ import { useWindow } from '@/hooks/useWindow.ts'
import { MittEnum, ModalEnum, PluginEnum } from '@/enums' import { MittEnum, ModalEnum, PluginEnum } from '@/enums'
import Mitt from '@/utils/Bus.ts' import Mitt from '@/utils/Bus.ts'
import { useLogin } from '@/hooks/useLogin.ts' import { useLogin } from '@/hooks/useLogin.ts'
import { STO } from '@/typings/stores'
const { createWebviewWindow } = useWindow() const { createWebviewWindow } = useWindow()
const { logout } = useLogin() const { logout } = useLogin()

View File

@ -16,7 +16,6 @@ import { delay } from 'lodash-es'
import router from '@/router' import router from '@/router'
import { listen } from '@tauri-apps/api/event' import { listen } from '@tauri-apps/api/event'
import { useMenuTopStore } from '@/stores/menuTop.ts' import { useMenuTopStore } from '@/stores/menuTop.ts'
import { STO } from '@/typings/stores'
export const leftHook = () => { export const leftHook = () => {
const prefers = matchMedia('(prefers-color-scheme: dark)') const prefers = matchMedia('(prefers-color-scheme: dark)')

View File

@ -1,6 +1,6 @@
<template> <template>
<div style="background: var(--left-bg-color)"> <div style="background: var(--left-bg-color)">
<div class="h-30px"></div> <div style="background: var(--left-bg-color)" class="h-30px"></div>
<main class="left min-w-64px h-full p-[0_6px_40px] box-border flex-col-center select-none" data-tauri-drag-region> <main class="left min-w-64px h-full p-[0_6px_40px] box-border flex-col-center select-none" data-tauri-drag-region>
<p class="text-(16px [--left-text-color]) cursor-default select-none m-[4px_0_16px_0]">HuLa</p> <p class="text-(16px [--left-text-color]) cursor-default select-none m-[4px_0_16px_0]">HuLa</p>
<!-- 头像模块 --> <!-- 头像模块 -->

View File

@ -1,6 +1,5 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { PluginEnum, StoresEnum } from '@/enums' import { PluginEnum, StoresEnum } from '@/enums'
import { STO } from '../typings/stores'
export const useMenuTopStore = defineStore( export const useMenuTopStore = defineStore(
StoresEnum.MENUTOP, StoresEnum.MENUTOP,

View File

@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
import { StoresEnum } from '@/enums' import { StoresEnum } from '@/enums'
import { statusItem } from '@/views/homeWindow/onlineStatus/config.ts' import { statusItem } from '@/views/homeWindow/onlineStatus/config.ts'
import Colorthief from 'colorthief' import Colorthief from 'colorthief'
import { STO } from '../typings/stores'
const colorthief = new Colorthief() const colorthief = new Colorthief()
export const onlineStatus = defineStore(StoresEnum.ONLINE_STATUS, { export const onlineStatus = defineStore(StoresEnum.ONLINE_STATUS, {

View File

@ -1,7 +1,6 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { PluginEnum, StoresEnum } from '@/enums' import { PluginEnum, StoresEnum } from '@/enums'
import { pluginsList } from '@/layout/left/config.tsx' import { pluginsList } from '@/layout/left/config.tsx'
import { STO } from '../typings/stores'
export const usePluginsStore = defineStore( export const usePluginsStore = defineStore(
StoresEnum.PLUGINS, StoresEnum.PLUGINS,
@ -13,7 +12,7 @@ export const usePluginsStore = defineStore(
/** /**
* *
* @param newPlugins * @param newPlugin
*/ */
const addPlugin = (newPlugin: STO.Plugins<PluginEnum>) => { const addPlugin = (newPlugin: STO.Plugins<PluginEnum>) => {
plugins.value.push(newPlugin) plugins.value.push(newPlugin)
@ -21,10 +20,10 @@ export const usePluginsStore = defineStore(
/** /**
* *
* @param newPlugins * @param p
*/ */
const removePlugin = (p: STO.Plugins<PluginEnum>) => { const removePlugin = (p: STO.Plugins<PluginEnum>) => {
const index = plugins.value.findIndex((i) => i.title === p.title) const index = plugins.value.findIndex((i: STO.Plugins<PluginEnum>) => i.title === p.title)
plugins.value.splice(index, 1) plugins.value.splice(index, 1)
} }
@ -33,7 +32,7 @@ export const usePluginsStore = defineStore(
* @param p * @param p
*/ */
const updatePlugin = (p: STO.Plugins<PluginEnum>) => { const updatePlugin = (p: STO.Plugins<PluginEnum>) => {
const index = plugins.value.findIndex((i) => i.title === p.title) const index = plugins.value.findIndex((i: STO.Plugins<PluginEnum>) => i.title === p.title)
if (index !== -1) { if (index !== -1) {
plugins.value[index] = p plugins.value[index] = p
} }

View File

@ -3,7 +3,6 @@ import { CloseBxEnum, StoresEnum, ShowModeEnum, ThemeEnum } from '@/enums'
import apis from '@/services/apis.ts' import apis from '@/services/apis.ts'
import { isDiffNow10Min } from '@/utils/ComputedTime.ts' import { isDiffNow10Min } from '@/utils/ComputedTime.ts'
import type { CacheBadgeItem } from '@/services/types.ts' import type { CacheBadgeItem } from '@/services/types.ts'
import { STO } from '../typings/stores'
const badgeCachedList = reactive<Record<number, Partial<CacheBadgeItem>>>({}) const badgeCachedList = reactive<Record<number, Partial<CacheBadgeItem>>>({})
// TODO 使用indexDB或sqlite缓存数据还需要根据每个账号来进行配置 (nyh -> 2024-03-26 01:22:12) // TODO 使用indexDB或sqlite缓存数据还需要根据每个账号来进行配置 (nyh -> 2024-03-26 01:22:12)

View File

@ -1,7 +1,6 @@
import { ShowModeEnum } from '../enums'
/** pinia的store的命名空间 */ /** pinia的store的命名空间 */
declare namespace STO { declare namespace STO {
import { ShowModeEnum } from '@/enums'
/** /**
* *
* @param themes * @param themes

View File

@ -153,7 +153,6 @@ import { lightTheme } from 'naive-ui'
import { useSettingStore } from '@/stores/setting.ts' import { useSettingStore } from '@/stores/setting.ts'
import { useLogin } from '@/hooks/useLogin.ts' import { useLogin } from '@/hooks/useLogin.ts'
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow' import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
import { STO } from '@/typings/stores'
const settingStore = useSettingStore() const settingStore = useSettingStore()
const { login } = storeToRefs(settingStore) const { login } = storeToRefs(settingStore)