123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import React, { useEffect, useState } from "react";
- import { useSearchParams } from "react-router-dom";
- import "./home.scss";
- const HomePage: React.FC = () => {
- const [searchParams] = useSearchParams();
- const [path, setPath] = useState(() => {
- // 优先使用 URL 参数
- return (
- searchParams.get("iframePath") ||
- "http://106.225.184.197:8686/#/CDSSPages"
- );
- });
- useEffect(() => {
- window["electronAPI"].on(
- "iframe",
- (result: { type: string; data: string }) => {
- const { data } = result;
- setPath(data);
- }
- );
- }, []);
- return (
- <div className="home">
- <webview
- id="webview"
- allow-popups="true"
- allow-scripts="true"
- src={path}
- style={{ border: "none", width: "100%", height: "100%" }}
- ></webview>
- {/* <iframe
- src={path}
- style={{ border: "none" }}
- width={"100%"}
- height={"100%"}
- allowFullScreen
- /> */}
- </div>
- );
- };
- export default HomePage;
|