夜间模式
安装
若想安装 F-BIM
有 包管理安装
和 CDN引入
两种方式
通过包管理器安装(推荐)
npm: npm install sadi-sdk-ts
yarn: yarn add sadi-sdk-ts
pnpm: pnpm install sadi-sdk-ts
通过 CDN 引入
html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<script type="module">
import * as sadi from "https://cdn.jsdelivr.net/npm/sadi-sdk-ts";
</script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<script type="module">
import * as sadi from "https://cdn.jsdelivr.net/npm/sadi-sdk-ts";
</script>
</body>
</html>
注意
SDK 只打包了 ESM 模块,无法通过普通 script 标签进行引入,必须为 script
标签添加 type="module"
属性开启 ES Modules
支持,但并非所有浏览器都支持,兼容性表见 caniuse,同时 module 块中定义的函数与变量无法在 html 中获得(需要通过 window 或者 globalThis 传递)。
通过 CDN 引入 (importmap 方式)
html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="importmap">
{
"imports": {
"sadi-sdk-ts": "https://cdn.jsdelivr.net/npm/sadi-sdk-ts"
}
}
</script>
</head>
<body>
<script type="module">
import * as sadi from "sadi-sdk-ts";
</script>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="importmap">
{
"imports": {
"sadi-sdk-ts": "https://cdn.jsdelivr.net/npm/sadi-sdk-ts"
}
}
</script>
</head>
<body>
<script type="module">
import * as sadi from "sadi-sdk-ts";
</script>
</body>
</html>