You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/02/05 15:31:48 UTC

[echarts-doc] branch master updated: modify typescript tree-shaking tutorial code

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-doc.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e8b0f7  modify typescript tree-shaking tutorial code
     new a18a073  Merge pull request #165 from FeynmanCheng/ts_treeshaking
7e8b0f7 is described below

commit 7e8b0f708d4e8eb4fedb0f55fa06c42a6cf46ffb
Author: FeynmanCheng <am...@qq.com>
AuthorDate: Fri Feb 5 21:04:04 2021 +0800

    modify typescript tree-shaking tutorial code
---
 en/tutorial/tree-shaking.md | 7 ++++++-
 zh/tutorial/tree-shaking.md | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/en/tutorial/tree-shaking.md b/en/tutorial/tree-shaking.md
index 4cc5804..baf384b 100644
--- a/en/tutorial/tree-shaking.md
+++ b/en/tutorial/tree-shaking.md
@@ -101,10 +101,15 @@ import {
 } from 'echarts/renderers';
 
 // Combine an Option type with only required components and charts via ComposeOption
-type ECOption = echarts.
+type ECOption = echarts.ComposeOption<
   BarSeriesOption | LineSeriesOption | TitleComponentOption | GridComponentOption
 >;
 
+// Register the required components
+echarts.use(
+    [TitleComponent, TooltipComponent, GridComponent, BarChart, CanvasRenderer]
+);
+
 var option: ECOption = {
     ...
 }
diff --git a/zh/tutorial/tree-shaking.md b/zh/tutorial/tree-shaking.md
index 7b3c40e..559b39f 100644
--- a/zh/tutorial/tree-shaking.md
+++ b/zh/tutorial/tree-shaking.md
@@ -105,7 +105,12 @@ type ECOption = echarts.ComposeOption<
   BarSeriesOption | LineSeriesOption | TitleComponentOption | GridComponentOption
 >;
 
+// 注册必须的组件
+echarts.use(
+    [TitleComponent, TooltipComponent, GridComponent, BarChart, CanvasRenderer]
+);
+
 var option: ECOption = {
     ...
 }
-```
\ No newline at end of file
+```


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org