wx-f2 icon indicating copy to clipboard operation
wx-f2 copied to clipboard

我在wepy框架下引用custom-compont链接里给的demo代码也能跑通,但有个defaultView的bug

Open xwangzhaox opened this issue 5 years ago • 4 comments

在wepy框架下我直接引用了custom-components的代码测试,可以在跑出来结果 需要把 function initChart(canvas, width, height) { 改成 const initChart = (canvas, width, height) => {

但是也碰到Cannot read property 'defaultView' of undefined这个问题。 页面下面有交代“检查是否有在 .wxss 文件中为 ff-canvas 组件定义 width 和 height 样式属性,如没有,加上即可” 看了下 f2-canvas.wxss 里面,是有这两个属性的定义 .f2-canvas { width: 100%; height: 100%; } 但是仍然会有defaultView的错误出现。后来试了下,发现是定义时,不能用“%“ 最后我选用了 .f2-canvas { mix-width: 100px; mix-height: 100px; } 这样页面就正常了,实际占比也会是因为以下样式的原因达到100%的效果 anvas { width:300px; height:150px; display:block; position:relative; }

xwangzhaox avatar Apr 02 '19 18:04 xwangzhaox

https://github.com/antvis/f2-canvas#%E9%97%AE%E9%A2%98-1

simaQ avatar Apr 03 '19 02:04 simaQ

请问怎样支持的

ybj6118 avatar May 15 '19 09:05 ybj6118

请问怎样支持的

wepy可以参考这个https://github.com/wqzwh/wepy-charts

WebGhan avatar May 27 '19 05:05 WebGhan

需要设置默认的css宽高才行

liangxinwei avatar Nov 01 '19 14:11 liangxinwei

这一点太重要了wepy可以参考这个https://github.com/wqzwh/wepy-charts

Fucntion avatar Apr 10 '20 07:04 Fucntion