antvis / F6

F6 is a graph visualization engine which provides quick and smooth operations on mobile devices.
https://f6.antv.vision
MIT License
133 stars 21 forks source link

微信小程序绘制图片报错 #142

Closed Mrchen128 closed 2 years ago

Mrchen128 commented 2 years ago

group.addShape('image', { attrs: { x: 8 - w / 2, y: 8 - h / 2, width: 24, height: 24, img: 'https://g.alicdn.com/cm-design/arms-trace/1.0.155/styles/armsTrace/images/TAIR.png', }, name: 'image-shape', }); 这段代码会报 TypeError: Cannot read property 'createImage' of undefined的错误,求解答

ICMI commented 2 years ago

初始化Graph的时候,记得传入container,值是canvas实例

ICMI commented 2 years ago

参考: https://github.com/antvis/F6/blob/d5b43ba3aec84ad84f8ba5e05217601e050f64d6/packages/examples-wx/package-elements/pages/elements/circle/index.js#L61

Mrchen128 commented 2 years ago

参考:

https://github.com/antvis/F6/blob/d5b43ba3aec84ad84f8ba5e05217601e050f64d6/packages/examples-wx/package-elements/pages/elements/circle/index.js#L61

感谢解答,可以了