89
89
</div >
90
90
<div class =" editor-content" :class =" [
91
91
{ 'circle-style': isCircleStyle },
92
- { 'horizontal-layout': horizontalLayout }
92
+ { 'horizontal-layout': horizontalLayout },
93
+ { 'hide-variables': !showVariablesEnabled },
94
+ { 'hide-keyboard': !showKeyboardEnabled }
93
95
]" >
94
- <div class =" variables-section" >
96
+ <div class =" variables-section" v-if = " showVariablesEnabled " >
95
97
<div class =" variables-search" >
96
98
<el-input v-model =" variableSearchText" placeholder =" 搜索变量" clearable :prefix-icon =" Search" />
97
99
</div >
104
106
</el-scrollbar >
105
107
</div >
106
108
</div >
107
- <Calculator :can-undo =" canUndo" :can-redo =" canRedo" :is-circle-style =" isCircleStyle" :t =" t" @number = " addNumber "
108
- @operator =" addOperator" @delete =" deleteLast" @undo =" undo" @redo =" redo" />
109
+ <Calculator v-if = " showKeyboardEnabled " :can-undo =" canUndo" :can-redo =" canRedo" :is-circle-style =" isCircleStyle" :t =" t"
110
+ @number = " addNumber " @ operator =" addOperator" @delete =" deleteLast" @undo =" undo" @redo =" redo" />
109
111
</div >
110
112
<div v-if =" previewMode" class =" preview-panel" >
111
113
<div class =" variables-input" >
@@ -188,13 +190,17 @@ interface Props {
188
190
showPreview? : boolean ;
189
191
showCopy? : boolean ;
190
192
showStyleToggle? : boolean ;
193
+ hideVariables? : boolean ; // 修改:showVariables -> hideVariables
194
+ hideKeyboard? : boolean ; // 修改:showKeyboard -> hideKeyboard
191
195
192
196
// 初始设置
193
197
initialSettings? : {
194
198
autoCompleteBrackets? : boolean ;
195
199
bracketColorEnabled? : boolean ;
196
200
isDarkMode? : boolean ;
197
- horizontalLayout? : boolean ; // 添加horizontalLayout默认值
201
+ horizontalLayout? : boolean ;
202
+ hideVariables? : boolean ; // 修改:showVariables -> hideVariables
203
+ hideKeyboard? : boolean ; // 修改:showKeyboard -> hideKeyboard
198
204
};
199
205
200
206
// 变量列表
@@ -232,11 +238,15 @@ const props = withDefaults(defineProps<Props>(), {
232
238
showPreview: true ,
233
239
showCopy: true ,
234
240
showStyleToggle: true ,
241
+ hideVariables: false , // 修改默认值
242
+ hideKeyboard: false , // 修改默认值
235
243
initialSettings : () => ({
236
244
autoCompleteBrackets: false ,
237
245
bracketColorEnabled: false ,
238
246
isDarkMode: false ,
239
- horizontalLayout: false // 添加horizontalLayout默认值
247
+ horizontalLayout: false ,
248
+ hideVariables: false , // 修改默认值
249
+ hideKeyboard: false , // 修改默认值
240
250
}),
241
251
variables : () => [],
242
252
modelValue: ' ' ,
@@ -302,6 +312,10 @@ const isCircleStyle = ref(false);
302
312
const showExpression = ref (false );
303
313
const horizontalLayout = ref (true ); // 添加horizontalLayout变量
304
314
315
+ // 添加显示控制的计算属性
316
+ const showVariablesEnabled = computed (() => ! props .hideVariables && ! props .initialSettings ?.hideVariables );
317
+ const showKeyboardEnabled = computed (() => ! props .hideKeyboard && ! props .initialSettings ?.hideKeyboard );
318
+
305
319
// 计算属性
306
320
const canUndo = computed (() => historyIndex .value > 0 );
307
321
const canRedo = computed (() => historyIndex .value < history .value .length - 1 );
@@ -1410,18 +1424,20 @@ const handleSettingsSave = (settings: {
1410
1424
bracketColorEnabled: boolean ;
1411
1425
horizontalLayout: boolean ;
1412
1426
language: string ;
1427
+ hideVariables: boolean ; // 修改
1428
+ hideKeyboard: boolean ; // 修改
1413
1429
}) => {
1414
1430
autoCompleteBrackets .value = settings .autoCompleteBrackets ;
1415
1431
bracketColorEnabled .value = settings .bracketColorEnabled ;
1416
1432
horizontalLayout .value = settings .horizontalLayout ;
1417
- // 添加语言设置的保存,保持布局设置不变
1418
1433
if (settings .language !== props .language ) {
1419
1434
emit (' update:language' , settings .language );
1420
1435
}
1421
- // 保存所有设置,包括当前的布局设置
1422
1436
localStorage .setItem (' editor-settings' , JSON .stringify ({
1423
1437
... settings ,
1424
- horizontalLayout: horizontalLayout .value
1438
+ horizontalLayout: horizontalLayout .value ,
1439
+ hideVariables: settings .hideVariables ,
1440
+ hideKeyboard: settings .hideKeyboard
1425
1441
}));
1426
1442
settingsDialogVisible .value = false ;
1427
1443
};
@@ -1439,7 +1455,9 @@ const loadSettings = () => {
1439
1455
autoCompleteBrackets: localSettings .autoCompleteBrackets ?? false ,
1440
1456
bracketColorEnabled: localSettings .bracketColorEnabled ?? false ,
1441
1457
isDarkMode: localSettings .isDarkMode ?? false ,
1442
- horizontalLayout: localSettings .horizontalLayout ?? true
1458
+ horizontalLayout: localSettings .horizontalLayout ?? true ,
1459
+ hideVariables: localSettings .hideVariables ?? false ,
1460
+ hideKeyboard: localSettings .hideKeyboard ?? false
1443
1461
};
1444
1462
1445
1463
autoCompleteBrackets .value = settings .autoCompleteBrackets ;
@@ -1670,4 +1688,26 @@ onMounted(() => {
1670
1688
1671
1689
<style lang="scss">
1672
1690
@import ' ../styles/index.scss' ;
1691
+
1692
+ .editor-content {
1693
+ display : flex ;
1694
+ gap : 16px ;
1695
+ transition : all 0.3s ease ;
1696
+
1697
+ & .hide-variables {
1698
+ .variables-section {
1699
+ display : none ;
1700
+ }
1701
+ }
1702
+
1703
+ & .hide-keyboard {
1704
+ .calculator {
1705
+ display : none ;
1706
+ }
1707
+ }
1708
+
1709
+ & .horizontal-layout {
1710
+ flex-direction : row ;
1711
+ }
1712
+ }
1673
1713
</style >
0 commit comments