-
-
Notifications
You must be signed in to change notification settings - Fork 72
关于在不同页面使用地图时<APILoader>的问题 #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@rubickkcibur 可以给我哥实例,你这个是服务端渲染的问题。服务端是没有 windows 和document 对象 |
@rubickkcibur Upgrade |
我更新了本地版本还是存在同样的问题,项目有点大,可以的话麻烦您看下https://github.com/rubickkcibur/cdc,地图使用在fe/src/pages/addroute,万分感谢! |
@rubickkcibur 我都不知道你这个怎么跑起来 |
不好意思,cd fe然后yarn next |
@rubickkcibur 你使用的是 next.js 前面没有时间看, 可能下面具有参考意见。 |
@rubickkcibur https://codesandbox.io/s/nextjs-example-react-codemirror-bimq7?file=/pages/index.js 参考实例: import { useEffect, useState } from "react";
import Link from "next/link";
function HomePage() {
const [comp, setComp] = useState();
useEffect(() => {
if (window) {
import("@uiw/react-codemirror").then((obj) => {
if (!comp) {
setComp(obj.default);
}
});
}
}, []);
const Comps = comp;
return (
<div>
<div>
Welcome to Next.js!
<Link href="/about">
<a>About</a>
</Link>
</div>
{Comps && (
<Comps
value="const a = 0;"
options={{
mode: "jsx"
}}
/>
)}
</div>
);
}
export default HomePage; |
Uh oh!
There was an error while loading. Please reload this page.
目前搭建的一个项目中需要分别在两个不同的页面使用Map组件,请问这时应该怎么使用APILoader?参考说明中只给了一个页面下的使用方法。
项目框架:react+typescript+next.js
The text was updated successfully, but these errors were encountered: