退出优化

This commit is contained in:
yj 2024-08-12 14:06:39 +08:00
parent c6acb6d584
commit 67b00d416d
4 changed files with 8 additions and 5 deletions

View File

@ -178,6 +178,9 @@ app.on('ready', () => {
case 'minimize':
mainWindow.minimize()
break;
case 'hide':
mainWindow.hide()
break;
}
});
// 导出是否全屏

View File

@ -1,7 +1,7 @@
import styles from '@/components/Operation/index.module.scss'
import ImageUrl from '@/utils/package/ImageUrl';
import { useEffect, useState } from "react";
type OperationKeyType = 'minimize' | 'quit' | 'maximize' | 'unmaximize';
type OperationKeyType = 'minimize' | 'quit' | 'maximize' | 'unmaximize' | 'hide';
type OperationType = {
icon: string;
key: OperationKeyType;

View File

@ -3,7 +3,7 @@ import { storage } from '@/utils';
import { InfoCircleOutlined } from '@ant-design/icons';
import { Button, Checkbox, Modal, Radio } from 'antd';
import { useState, useImperativeHandle, forwardRef } from "react";
type OperationKeyType = 'minimize' | 'quit' | 'maximize' | 'unmaximize';
type OperationKeyType = 'minimize' | 'quit' | 'maximize' | 'unmaximize' | 'hide';
const QuitTips = forwardRef((props: any, ref: any) => {
useImperativeHandle(ref, () => ({
changeModal: () => {
@ -12,7 +12,7 @@ const QuitTips = forwardRef((props: any, ref: any) => {
}))
const [isCloseModal, setIsCloseModal] = useState(false);
const [isTips, setIsTips] = useState(false);
const [optionsValue, setOperation] = useState<OperationKeyType>('minimize');
const [optionsValue, setOperation] = useState<OperationKeyType>('hide');
return (
<>
<Modal
@ -38,7 +38,7 @@ const QuitTips = forwardRef((props: any, ref: any) => {
<Radio.Group onChange={(e) => {
setOperation(e.target.value);
}} value={optionsValue}>
<Radio value={'minimize'}>退</Radio>
<Radio value={'hide'}>退</Radio>
<Radio value={'quit'}>退</Radio>
</Radio.Group>
</div>

2
src/render.d.ts vendored
View File

@ -1,7 +1,7 @@
// electron-env.d.ts
export interface IElectronAPI {
setMainWindowSize: (config: any) => void;
setViewStatus: (status: 'quit' | 'maximize' | 'minimize' | 'unmaximize') => void;
setViewStatus: (status: 'quit' | 'maximize' | 'minimize' | 'unmaximize' | 'hide') => void;
getIsMaximized: () => Promise<boolean>;
setWriteText: (text: string) => void;
onQuit: (callBack: Function) => void;