最新版本的rax,在chrome里面运行rax的charts例子时,界面没出来,会出现如下错误:
this.chartInstance.getContext(...).then is not a function
对应软件版本如下:
ali-1c36bbec746f:rax lzf$ node -v
v9.11.1
ali-1c36bbec746f:rax lzf$ rax -v
rax-cli: 0.6.1
rax: 0.6.1
ali-1c36bbec746f:rax lzf$ npm -v
6.0.0
ali-1c36bbec746f:rax lzf$ weex -v
v1.3.5
- weexpack : v1.2.3
- weex-builder : v0.4.0
- weex-previewer : v1.5.1
ali-1c36bbec746f:rax lzf$ webpack -v
4.6.0
分析源码逻辑,原因出在canvas对象并非异步对象,可能原因(weex和chrome内实现不一致),修改如下:
50 _createClass(Chart, [{
51 key: 'componentDidMount',
52 value: function componentDidMount() {
53 var _this2 = this;
54
55 //this.chartInstance.getContext().then(function (context) {
56 this.draw(this.chartInstance.getContext());
57 //});
58 }
59 },