extends React.Component
{
5 | private isHooked: boolean = false;
6 |
7 | protected hookWindowResized() {
8 | try {
9 | if (this.isHooked) {
10 | return;
11 | }
12 | this.isHooked = true;
13 | getCurrentWindow().onResized(({payload: size}) => {
14 | this.forceUpdate();
15 | }).then(_ => {
16 | });
17 | } catch (e) {
18 |
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/apis/TranslateApi.ts:
--------------------------------------------------------------------------------
1 | export class TranslateApi {
2 |
3 | public static async translate(text: string) {
4 | try {
5 | const res = await fetch("https://api.v1st.net/https://translate.googleapis.com/translate_a/single?client=gtx&dt=t&sl=en&tl=zh-CN&q=" + text, {
6 | method: "GET",
7 | });
8 | const array = await res.json();
9 | let translateText = "";
10 | for (const item of array[0]) {
11 | translateText += item[0];
12 | }
13 | return translateText;
14 | } catch (_) {
15 | return text;
16 | }
17 | }
18 | }
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/components/MessageBox.ts:
--------------------------------------------------------------------------------
1 | import {Modal} from "antd";
2 | import {ModalFuncProps} from "antd/es/modal/interface";
3 |
4 | export class MessageBox {
5 |
6 | static async confirm(props: ModalFuncProps): Promise