解决build失败

This commit is contained in:
hujinwei
2022-11-30 20:13:35 +08:00
parent 033015ae36
commit d70b4460af
2 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import "./index.css";
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
import {useEffect, useRef, useState} from "react";
import {Routes, Route, Link, useParams} from 'react-router-dom';
import { Link, useParams } from 'react-router-dom';
interface MenuProp {
title: string;
@ -21,13 +21,6 @@ function Examples() {
const iframeRef = useRef<HTMLIFrameElement>();
const { id } = useParams();
const getCode = (url: string) => {
if (!url) return;
fetch(url, {mode: 'cors'}).then(data => data.text()).then((data) => {
run(data);
})
}
const run = (code: string) => {
const preview = document.querySelector("#preview") as HTMLElement;
preview.innerHTML = "";
@ -40,6 +33,13 @@ function Examples() {
}
}
const getCode = (url: string) => {
if (!url) return;
fetch(url, {mode: 'cors'}).then(data => data.text()).then((data) => {
run(data);
})
}
useEffect(() => {
fetch("./config.json").then(data => data.json()).then((data) => {
const indexMenus:string[] = [];
@ -64,6 +64,7 @@ function Examples() {
}
});
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, data])