mirror of
https://github.com/JOYCEQL/magic-resume.git
synced 2026-07-03 14:07:11 +02:00
fix: html2pdf ssr error
This commit is contained in:
@@ -272,7 +272,7 @@ export default function Home() {
|
||||
exit={{ x: "-100%" }}
|
||||
transition={{ type: "spring", damping: 20 }}
|
||||
>
|
||||
<SidePanel onClose={() => setShowMobileSidebar(false)} />
|
||||
<SidePanel />
|
||||
</motion.div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -24,26 +24,6 @@ const IconSelector = ({ value, onChange, theme = "light" }) => {
|
||||
const [open, setOpen] = React.useState(false);
|
||||
const [icons, setIcons] = React.useState(ICONS);
|
||||
|
||||
// 在组件挂载时加载图标
|
||||
React.useEffect(() => {
|
||||
const loadIcons = async () => {
|
||||
const lucide = await import("lucide-react");
|
||||
// console.log(lucide, "lucide");
|
||||
// const iconList = Object.entries(lucide)
|
||||
// .filter(
|
||||
// ([name]) => name[0] === name[0].toUpperCase() // 只选择以大写字母开头的导出(图标组件)
|
||||
// )
|
||||
// ?.map(([name, component]) => ({
|
||||
// name,
|
||||
// component
|
||||
// }));
|
||||
// console.log(iconList, "iconList");
|
||||
// setIcons(iconList);
|
||||
};
|
||||
|
||||
loadIcons();
|
||||
}, []);
|
||||
|
||||
// 获取当前选中的图标组件
|
||||
const getCurrentIcon = React.useCallback(() => {
|
||||
if (!value) return User;
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
import React, { useState } from "react";
|
||||
import { motion } from "framer-motion";
|
||||
import { Download, Loader2 } from "lucide-react";
|
||||
import html2pdf from "html2pdf.js";
|
||||
import { useResumeStore } from "@/store/useResumeStore";
|
||||
import dynamic from "next/dynamic";
|
||||
const html2pdf = dynamic(() => import("html2pdf.js"), { ssr: false });
|
||||
|
||||
export function PdfExport() {
|
||||
const { basic, theme } = useResumeStore();
|
||||
@@ -30,7 +31,6 @@ export function PdfExport() {
|
||||
orientation: "portrait"
|
||||
}
|
||||
};
|
||||
|
||||
const res = html2pdf().set(opt).from(element).save();
|
||||
setIsExporting(false);
|
||||
return res;
|
||||
|
||||
@@ -65,7 +65,7 @@ const initialState = {
|
||||
phone: "13800138000",
|
||||
location: "北京市",
|
||||
summary: "5年前端开发经验...",
|
||||
birthDate: "1995-01-01",
|
||||
birthDate: "",
|
||||
icons: {},
|
||||
customFields: []
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user