Explorar o código

html 可以为 undefind

visuddhinanda %!s(int64=3) %!d(string=hai) anos
pai
achega
723eb269a3
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      dashboard/src/components/template/MdView.tsx

+ 6 - 2
dashboard/src/components/template/MdView.tsx

@@ -1,11 +1,15 @@
 import { TCodeConvertor, XmlToReact } from "./utilities";
 
 interface IWidget {
-  html: string;
+  html?: string;
   wordWidget?: boolean;
   convertor?: TCodeConvertor;
 }
-const Widget = ({ html, wordWidget = false, convertor }: IWidget) => {
+const Widget = ({
+  html = "<div></div>",
+  wordWidget = false,
+  convertor,
+}: IWidget) => {
   const jsx = XmlToReact(html, wordWidget, convertor);
   return <>{jsx}</>;
 };