Skip to content

Commit 8b5f04c

Browse files
authored
docs(get-start): add docs when use with script (#3581)
1 parent 21a48f7 commit 8b5f04c

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

docs/manual/getting-started.en.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ You can either download the script locally or directly import online resources:
3939
<script src="./g2.js"></script>
4040
```
4141

42+
Use G2 with `script` in html, we should add the prefix `G2`, below:
43+
44+
```ts
45+
const chart = new G2.Chart({
46+
/* your options */
47+
});
48+
```
49+
4250
<!-- 请求链接 404 先注释掉 -->
4351
<!-- You can also directly download through [unpkg](https://unpkg.com/@antv/g2). -->
4452

docs/manual/getting-started.zh.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ const chart = new Chart({
3939
<script src="./g2.js"></script>
4040
```
4141

42+
使用 `script` 标签引入 G2 资源时,挂载在 window 上的变量名为 `G2`,所以在上述实例中需要加上 `G2` 的前缀。如下:
43+
44+
```ts
45+
const chart = new G2.Chart({
46+
/* your options */
47+
});
48+
```
49+
4250
<!-- 请求链接 404 先注释掉 -->
4351
<!-- 你也可以直接通过  [unpkg](https://unpkg.com/@antv/g2)  下载。 -->
4452

0 commit comments

Comments
 (0)