From 883e024737c1151ae5d40c39506ec0525c161f40 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Wed, 13 Jun 2018 17:10:53 +0800 Subject: [PATCH] feat(tooltip): use non-html tooltip when document is not defined --- src/component/tooltip/TooltipModel.js | 5 ++++- src/component/tooltip/TooltipView.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/component/tooltip/TooltipModel.js b/src/component/tooltip/TooltipModel.js index 3161aaa54..5fe862be0 100644 --- a/src/component/tooltip/TooltipModel.js +++ b/src/component/tooltip/TooltipModel.js @@ -46,7 +46,10 @@ export default echarts.extendComponentModel({ displayMode: 'single', // 'single' | 'multipleByCoordSys' - useHtml: true, + useHtml: 'auto', // 'auto', true, or false + // 'auto': use html by default, and use non-html if `document` is not defined + // true: use html for tooltip + // false: use canvas, svg, and etc. for tooltip // 位置 {Array} | {Function} // position: null diff --git a/src/component/tooltip/TooltipView.js b/src/component/tooltip/TooltipView.js index ebf737d46..0427904ef 100644 --- a/src/component/tooltip/TooltipView.js +++ b/src/component/tooltip/TooltipView.js @@ -51,7 +51,9 @@ export default echarts.extendComponentView({ var tooltip = ecModel.get('tooltip'); this._isRich = false; - if (tooltip.length && tooltip[0].useHtml === false) { + if (tooltip.length && (tooltip[0].useHtml === false // force using non-html + || tooltip[0].useHtml === 'auto' && !document)) // auto using non-html when no `document` + { this._isRich = true; } -- GitLab