Skip to content

Commit

Permalink
🐞 fix: 修复体验优化和移除元素板块不显示标题的Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
andywang425 committed Sep 13, 2023
1 parent 23e02c7 commit 742235c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/stores/useUIStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
import { reactive, computed, CSSProperties, watch } from 'vue'
import Storage from '../library/storage'
import _ from 'lodash'
import { IuiConfig } from '../types'
import { IuiConfig, menuIndex } from '../types'

interface IbaseStyleValue {
top: number
Expand All @@ -16,10 +16,12 @@ export const useUIStore = defineStore('ui', () => {
const uiConfig: IuiConfig = reactive(Storage.getUiConfig())
// 被激活的菜单项的名称,用于在 Header 里显示子标题
const activeMenuName = computed<string>(() => {
const index2name: { [index: string]: string } = {
const index2name: { [index in menuIndex]: string } = {
MainSiteTasks: '主站任务',
LiveTasks: '直播任务',
OtherTasks: '其它任务'
OtherTasks: '其它任务',
EnhanceExperience: '体验优化',
RemoveElement: '移除元素'
}
return index2name[uiConfig.activeMenuIndex]
})
Expand Down Expand Up @@ -64,7 +66,7 @@ export const useUIStore = defineStore('ui', () => {
*设置被激活菜单项的名称,配合 el-menu 的 `@select` 使用
* @param index 被激活菜单项
*/
function setActiveMenuIndex(index: string) {
function setActiveMenuIndex(index: menuIndex) {
uiConfig.activeMenuIndex = index
}
// 监听UI配置信息的变化,使用防抖降低油猴写配置信息频率
Expand Down
6 changes: 4 additions & 2 deletions src/types/storage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ interface ImoduleConfig {
}
}

type menuIndex = 'MainSiteTasks' | 'LiveTasks' | 'OtherTasks' | 'EnhanceExperience' | 'RemoveElement'

interface IuiConfig {
isCollapse: boolean
isShowPanel: boolean
activeMenuIndex: string
activeMenuIndex: menuIndex
}

interface Icache {
lastAliveHeartBeatTime: number
}

export { ImoduleConfig, IuiConfig, Icache }
export { ImoduleConfig, IuiConfig, Icache, menuIndex }

0 comments on commit 742235c

Please sign in to comment.