Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: fix indicator when change visible to be false, fix #3506\n\n",
"type": "none",
"packageName": "@visactor/vchart"
}
],
"packageName": "@visactor/vchart",
"email": "[email protected]"
}
12 changes: 10 additions & 2 deletions packages/vchart/src/component/indicator/indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,16 @@ export class Indicator<T extends IIndicatorSpec> extends BaseComponent<T> implem
} as IndicatorAttributes;
}

private _createOrUpdateIndicatorComponent(attrs: IndicatorAttributes): IndicatorComponents {
private _createOrUpdateIndicatorComponent(attrs: IndicatorAttributes) {
if (attrs.visible === false) {
// 按照vrender-component 的设置,只切换visible: false,并不会更新组件,所以强制删掉节点
if (this._indicatorComponent && this._indicatorComponent.parent) {
this._indicatorComponent.parent.removeChild(this._indicatorComponent);
}
this._indicatorComponent = null;
return;
}

if (this._indicatorComponent) {
if (!isEqual(attrs, this._cacheAttrs)) {
this._indicatorComponent.setAttributes(attrs);
Expand All @@ -226,7 +235,6 @@ export class Indicator<T extends IIndicatorSpec> extends BaseComponent<T> implem
);
}
this._cacheAttrs = attrs;
return this._indicatorComponent;
}

private _createText(
Expand Down
Loading