Skip to content

Commit fa5c5e2

Browse files
committed
refactor!: 窗口宽度改为配置文件全局设置
1 parent 4385140 commit fa5c5e2

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/assets/styles/globals.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
--g-sidebar-logo-height: 50px;
1111
// 顶栏高度
1212
--g-topbar-height: 50px;
13-
// 窗口宽度
14-
--g-window-width: 1000px;
1513
// 窗口高度(仅在窗口预览时使用)
1614
--g-window-height: 800px;
1715
// 窗口预览缩放系数

src/settings.default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const globalSettingsDefault: RecursiveRequired<Settings.all> = {
2525
enableHotkeys: true,
2626
},
2727
window: {
28+
defaultWidth: 1000,
2829
enableHotkeys: true,
2930
},
3031
copyright: {

src/types/global.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ declare namespace Settings {
100100
enableHotkeys?: boolean
101101
}
102102
interface window {
103+
/**
104+
* 窗口默认宽度,设置为数字时单位为 px
105+
* @默认值 `1000`
106+
*/
107+
defaultWidth?: string | number
103108
/**
104109
* 是否开启窗口快捷键
105110
* @默认值 `true`

src/views/components/Dashboard/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function maskClick(windowName: string) {
109109
</div>
110110
</div>
111111
<TransitionGroup v-show="windowStore.list.length > 0" name="window" tag="div" class="dashboard-container">
112-
<div v-for="element in windowStore.list" :key="element.name" :ref="setWindowItemRef" class="window">
112+
<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`};`">
113113
<div
114114
class="window-container" :class="{
115115
preview: settingsStore.previewAllWindows,

0 commit comments

Comments
 (0)