mirror of
https://github.com/yaklang/yaklang-chrome-extension.git
synced 2026-09-22 03:10:43 +08:00
add controller
This commit is contained in:
+2
-1
@@ -1,13 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import {Layout, Row} from 'antd';
|
import {Layout, Row} from 'antd';
|
||||||
|
import {Controller} from "./components/Controller";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div className="App" style={{width: 300, backgroundColor: "#eee", padding: 8}}>
|
<div className="App" style={{width: 300, backgroundColor: "#eee", padding: 8}}>
|
||||||
<Layout>
|
<Layout>
|
||||||
<Row>
|
<Row>
|
||||||
Hello WOrld First
|
<Controller/>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
PROXY
|
PROXY
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import React, {useState} from "react";
|
|
||||||
|
|
||||||
export const Controller = (props) => {
|
|
||||||
const [connected, setConnected] = useState(false);
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import React, {useEffect} from "react";
|
||||||
|
import {Card} from "antd";
|
||||||
|
|
||||||
|
export interface ControllerProp {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Controller: React.FC<ControllerProp> = (props) => {
|
||||||
|
const [connected, setConnected] = React.useState<boolean>(false)
|
||||||
|
const ref = React.useRef<HTMLAnchorElement>(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!ref) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// const update = () => {
|
||||||
|
// ref.current.click()
|
||||||
|
// }
|
||||||
|
// const id = setInterval(update, 10000)
|
||||||
|
// return () => {
|
||||||
|
// clearInterval(id)
|
||||||
|
// }
|
||||||
|
}, [ref])
|
||||||
|
|
||||||
|
return <Card size={"small"} title={"连接器"}>
|
||||||
|
<a href={"yakitctrl://start/"} ref={ref}>Yakit 启动</a>
|
||||||
|
</Card>
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user