This library was generated with Nx.
全局安装以下两个包吧,方便点 npm install -g typedoc serve
typedoc --tsconfig tsconfig-doc.json
serve docs
- 先设置代理和token ,要求能访问到接口
- 使用 useStationInfos 获取站点信息,用以拼合数据
- React 环境下使用这个,比如 Nextjs , 注意安装peer依赖
import { DemoPage, setMeteoConfig, useStationInfos } from "@zhajizhaji/meteo-hooks";
import { useEffect } from 'react'
setMeteoConfig({
host: "https://sszc.sentinels.site",
sign:"http://shuzicang.sentinels.site/api/public/sign",
gm:"http://shuzicang.sentinels.site/api/public/gm",
key:cookie.get("key")
})
const adminCodes = ["330000"];
export default function Meteo() {
const { data, loading, fetchData } = useStationInfos();
// 使用 onInitialize 钩子,在组件初始化时触发加载数据
useEffect(() => {
if (data === null && !loading) {
fetchData(adminCodes);
}
}, [loading, data, fetchData]);
return <div className="">
<DemoPage />
</div>
}