Package Exports
- @antv/g-compat
- @antv/g-compat/dist/index.esm.js
- @antv/g-compat/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@antv/g-compat) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
English | 简体中文
Provides partial G 4.0 compatible APIs, e.g.
// 4.0
circle.getCount();
// Equivalent to DOM API
circle.childElementCount;Package name inspired by @vue/compat.
https://v3-migration.vuejs.org/migration-build.html
Deprecated API
The following APIs provided in G 4.0 can be replaced by the corresponding DOM APIs in the new version.
getCount
Get the number of child nodes.
circle.getCount(); // [0]
// Equivalent to
circle.childElementCount; // [0]getParent
Get the parent node.
circle.getParent();
// Equivalent to
circle.parentElement;getChildren
Get the list of child nodes.
circle.getChildren();
// Equivalent to
circle.children;getFirst
Get the first child node.
circle.getFirst();
// Equivalent to
circle.firstElementChild;getLast
Get the last child node.
circle.getLast();
// Equivalent to
circle.lastElementChild;getChildByIndex
Get child nodes by index.
circle.getChildByIndex(index);
// Equivalent to
circle.children[index];add
Add child nodes.
parent.add(child);
// Equivalent to
parent.appendChild(child);setClip
Set the cropped graphics.
circle.setClip(clipPath);
// Equivalent to
circle.style.clipPath = clipPath;getClip
Get cropped graphics.
circle.getClip();
// Equivalent to
circle.style.clipPath;set
Set in the initialization configuration.
circle.set('my-prop', 1);
// Equivalent to
circle.config['my-prop'] = 1;get
Obtain in the initialization configuration.
circle.get('my-prop');
// Equivalent to
circle.config['my-prop'];show
Show node.
circle.show();
// Equivalent to
circle.style.visibility = 'visible';hide
Hide node.
circle.hide();
// Equivalent to
circle.style.visibility = 'hidden';moveTo / move
Moving node in the world coordinate system.
circle.moveTo(x, y, z);
circle.move(x, y, z);
// Equivalent to
circle.setPosition(x, y, z);setZIndex
Set the zIndex of node:
circle.setZIndex(100);
// Equivalent to
circle.style.zIndex = 100;