Parcourir la source

html 可以为 undefind

visuddhinanda il y a 3 ans
Parent
commit
723eb269a3
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  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}</>;
 };