Skip to content

Commit

Permalink
refactor!: 窗口宽度改为配置文件全局设置
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed Jul 10, 2024
1 parent 4385140 commit fa5c5e2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/assets/styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
--g-sidebar-logo-height: 50px;
// 顶栏高度
--g-topbar-height: 50px;
// 窗口宽度
--g-window-width: 1000px;
// 窗口高度(仅在窗口预览时使用)
--g-window-height: 800px;
// 窗口预览缩放系数
Expand Down
1 change: 1 addition & 0 deletions src/settings.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const globalSettingsDefault: RecursiveRequired<Settings.all> = {
enableHotkeys: true,
},
window: {
defaultWidth: 1000,
enableHotkeys: true,
},
copyright: {
Expand Down
5 changes: 5 additions & 0 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ declare namespace Settings {
enableHotkeys?: boolean
}
interface window {
/**
* 窗口默认宽度,设置为数字时单位为 px
* @默认值 `1000`
*/
defaultWidth?: string | number
/**
* 是否开启窗口快捷键
* @默认值 `true`
Expand Down
2 changes: 1 addition & 1 deletion src/views/components/Dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function maskClick(windowName: string) {
</div>
</div>
<TransitionGroup v-show="windowStore.list.length > 0" name="window" tag="div" class="dashboard-container">
<div v-for="element in windowStore.list" :key="element.name" :ref="setWindowItemRef" class="window">
<div v-for="element in windowStore.list" :key="element.name" :ref="setWindowItemRef" class="window" :style="`--g-window-width: ${typeof settingsStore.settings.window.defaultWidth === 'string' ? settingsStore.settings.window.defaultWidth : `${settingsStore.settings.window.defaultWidth}px`};`">
<div
class="window-container" :class="{
preview: settingsStore.previewAllWindows,
Expand Down

0 comments on commit fa5c5e2

Please sign in to comment.