File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,39 @@ const result = await client.social.getSocialQqUserinfo({ qq: '10001' })
2323console .log (result )
2424```
2525
26+ ## CDN 引入
27+
28+ ` uapi-browser-sdk ` 已发布到 npm,因此任意支持 npm 包的 CDN 都可以直接加载,无需构建步骤。推荐做法是按照下面的示例引用,并在生产环境中固定版本号(` @latest ` 适合快速试用)。
29+
30+ ### jsDelivr(官方推荐)
31+
32+ ``` html
33+ <script type =" module" >
34+ import { UapiClient } from ' https://cdn.jsdelivr.net/npm/uapi-browser-sdk@latest/dist/index.js' ;
35+
36+ const client = new UapiClient (' https://uapis.cn/api/v1' );
37+ const data = await client .network .getNetworkMyip ();
38+ console .log (data);
39+ </script >
40+ ```
41+
42+ ### UNPKG(原生 ESM)
43+
44+ ``` html
45+ <script type =" module" >
46+ import { UapiClient } from ' https://unpkg.com/uapi-browser-sdk@latest/dist/index.js?module' ;
47+ // ...
48+ </script >
49+ ```
50+
51+ ### ESM CDN(esm.run / esm.sh 等)
52+
53+ ``` ts
54+ import { UapiClient } from ' https://esm.run/uapi-browser-sdk@latest' ;
55+ ```
56+
57+ 以上三种方式都会返回同一份浏览器原生 ESM 模块,因此可以根据团队的缓存策略或地理覆盖选择最合适的 CDN。
58+
2659## 特性
2760
2861现在你不再需要反反复复的查阅文档了。
You can’t perform that action at this time.
0 commit comments