如果暂时没有解决方案,请问怎么样才可以override 呢?
在angular typescript,我尝试
G6.registerNode("extendedCircle", {
extendedNodeType: 'circle',
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
drawShape: customDrawCircleShape
});
function customDrawCircleShape(cfg, group) {
var _a = (this.mergeStyle || this.getOptions(cfg)).icon,
defaultIcon = _a === void 0 ? {} : _a;
var style = this.getShapeStyle(cfg);
var icon = deepMix({}, defaultIcon, cfg.icon);
var name = "".concat(this.type, "-keyShape");
var keyShape = group.addShape('circle', {
attrs: style,
className: name,
name: name,
draggable: true
});
group['shapeMap'][name] = keyShape;
var width = icon.width,
height = icon.height,
show = icon.show,
text = icon.text;
if (show) {
var iconName = "".concat(this.type, "-icon");
if (text) {
group['shapeMap'][iconName] = group.addShape('text', {
attrs: __assign({
x: 0,
y: 0,
fontSize: 12,
fill: '#000',
stroke: '#000',
textBaseline: 'middle',
textAlign: 'center'
}, icon),
className: iconName,
name: iconName,
draggable: true
});
} else {
group['shapeMap'][iconName] = group.addShape('image', {
attrs: __assign({
x: -width / 2,
y: -height / 2
}, icon),
className: iconName,
name: iconName,
draggable: true
});
}
}
this.drawLinkPoints(cfg, group);
return keyShape;
}
但得到
An error occurred: this.getOptions is not a function
**这个override/extend的问题已解决**