mirror of
https://gitee.com/HuLaSpark/HuLa.git
synced 2024-11-29 18:28:30 +08:00
fix(layout): 🐛 修复侧边栏顶部空白块颜色和无法缩小主页面问题
This commit is contained in:
parent
96ad89c05d
commit
1999f30b0e
@ -281,7 +281,7 @@ export enum PluginEnum {
|
||||
/** 菜单显示模式 */
|
||||
export enum ShowModeEnum {
|
||||
/** 图标方式 */
|
||||
ICON = 0,
|
||||
ICON,
|
||||
/** 文字方式 */
|
||||
TEXT
|
||||
}
|
||||
|
@ -311,6 +311,7 @@ const handleResize = async (e: Event) => {
|
||||
|
||||
const initWindowHeight = async () => {
|
||||
let homeWindow = await WebviewWindow.getByLabel('home')
|
||||
await homeWindow?.setResizable(true)
|
||||
let size = await homeWindow?.size()
|
||||
let sf = await homeWindow?.scaleFactor()
|
||||
if (homeWindow && size && sf) {
|
||||
@ -350,32 +351,6 @@ onMounted(() => {
|
||||
setTimeout(() => {
|
||||
tipShow.value = false
|
||||
}, 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>
|
||||
<style lang="scss" scoped>
|
||||
|
@ -146,7 +146,6 @@ import { MittEnum, PluginEnum } from '@/enums'
|
||||
import { pluginsList } from '@/layout/left/config.tsx'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import { usePluginsStore } from '@/stores/plugins.ts'
|
||||
import { STO } from '@/typings/stores'
|
||||
import Mitt from '@/utils/Bus'
|
||||
|
||||
const settingStore = useSettingStore()
|
||||
|
@ -127,7 +127,6 @@
|
||||
import { MittEnum, PluginEnum } from '@/enums'
|
||||
import { pluginsList } from '@/layout/left/config.tsx'
|
||||
import { usePluginsStore } from '@/stores/plugins.ts'
|
||||
import { STO } from '@/typings/stores'
|
||||
import Mitt from '@/utils/Bus'
|
||||
|
||||
const pluginsStore = usePluginsStore()
|
||||
|
@ -2,7 +2,6 @@ import { useWindow } from '@/hooks/useWindow.ts'
|
||||
import { MittEnum, ModalEnum, PluginEnum } from '@/enums'
|
||||
import Mitt from '@/utils/Bus.ts'
|
||||
import { useLogin } from '@/hooks/useLogin.ts'
|
||||
import { STO } from '@/typings/stores'
|
||||
|
||||
const { createWebviewWindow } = useWindow()
|
||||
const { logout } = useLogin()
|
||||
|
@ -16,7 +16,6 @@ import { delay } from 'lodash-es'
|
||||
import router from '@/router'
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
import { useMenuTopStore } from '@/stores/menuTop.ts'
|
||||
import { STO } from '@/typings/stores'
|
||||
|
||||
export const leftHook = () => {
|
||||
const prefers = matchMedia('(prefers-color-scheme: dark)')
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<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>
|
||||
<p class="text-(16px [--left-text-color]) cursor-default select-none m-[4px_0_16px_0]">HuLa</p>
|
||||
<!-- 头像模块 -->
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { PluginEnum, StoresEnum } from '@/enums'
|
||||
import { STO } from '../typings/stores'
|
||||
|
||||
export const useMenuTopStore = defineStore(
|
||||
StoresEnum.MENUTOP,
|
||||
|
@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
|
||||
import { StoresEnum } from '@/enums'
|
||||
import { statusItem } from '@/views/homeWindow/onlineStatus/config.ts'
|
||||
import Colorthief from 'colorthief'
|
||||
import { STO } from '../typings/stores'
|
||||
|
||||
const colorthief = new Colorthief()
|
||||
export const onlineStatus = defineStore(StoresEnum.ONLINE_STATUS, {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { PluginEnum, StoresEnum } from '@/enums'
|
||||
import { pluginsList } from '@/layout/left/config.tsx'
|
||||
import { STO } from '../typings/stores'
|
||||
|
||||
export const usePluginsStore = defineStore(
|
||||
StoresEnum.PLUGINS,
|
||||
@ -13,7 +12,7 @@ export const usePluginsStore = defineStore(
|
||||
|
||||
/**
|
||||
* 设置插件
|
||||
* @param newPlugins 插件数据
|
||||
* @param newPlugin 插件数据
|
||||
*/
|
||||
const addPlugin = (newPlugin: STO.Plugins<PluginEnum>) => {
|
||||
plugins.value.push(newPlugin)
|
||||
@ -21,10 +20,10 @@ export const usePluginsStore = defineStore(
|
||||
|
||||
/**
|
||||
* 删除插件
|
||||
* @param newPlugins 插件数据
|
||||
* @param p 插件数据
|
||||
*/
|
||||
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)
|
||||
}
|
||||
|
||||
@ -33,7 +32,7 @@ export const usePluginsStore = defineStore(
|
||||
* @param p 插件
|
||||
*/
|
||||
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) {
|
||||
plugins.value[index] = p
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import { CloseBxEnum, StoresEnum, ShowModeEnum, ThemeEnum } from '@/enums'
|
||||
import apis from '@/services/apis.ts'
|
||||
import { isDiffNow10Min } from '@/utils/ComputedTime.ts'
|
||||
import type { CacheBadgeItem } from '@/services/types.ts'
|
||||
import { STO } from '../typings/stores'
|
||||
|
||||
const badgeCachedList = reactive<Record<number, Partial<CacheBadgeItem>>>({})
|
||||
// TODO 使用indexDB或sqlite缓存数据,还需要根据每个账号来进行配置 (nyh -> 2024-03-26 01:22:12)
|
||||
|
3
src/typings/stores.d.ts
vendored
3
src/typings/stores.d.ts
vendored
@ -1,7 +1,6 @@
|
||||
import { ShowModeEnum } from '../enums'
|
||||
|
||||
/** pinia的store的命名空间 */
|
||||
declare namespace STO {
|
||||
import { ShowModeEnum } from '@/enums'
|
||||
/**
|
||||
* 设置
|
||||
* @param themes 主题设置
|
||||
|
@ -153,7 +153,6 @@ import { lightTheme } from 'naive-ui'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import { useLogin } from '@/hooks/useLogin.ts'
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { STO } from '@/typings/stores'
|
||||
|
||||
const settingStore = useSettingStore()
|
||||
const { login } = storeToRefs(settingStore)
|
||||
|
Loading…
Reference in New Issue
Block a user