wx-f2
wx-f2 copied to clipboard
我在wepy框架下引用custom-compont链接里给的demo代码也能跑通,但有个defaultView的bug
在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; }
https://github.com/antvis/f2-canvas#%E9%97%AE%E9%A2%98-1
请问怎样支持的
请问怎样支持的
wepy可以参考这个https://github.com/wqzwh/wepy-charts
需要设置默认的css宽高才行
这一点太重要了wepy可以参考这个https://github.com/wqzwh/wepy-charts