Gcanvas-For-Apache-weex
Gcanvas-For-Apache-weex copied to clipboard
web端在使用插件是出错,ios端也无法显示图形
import App from './index.vue';
import GCanvas from 'weex-gcanvas'
console.log(Vue.component)
Vue.component('gcanvas', GCanvas)
new Vue(
Vue.util.extend({
el: '#root'
}, App)
)
vue.runtime.js:565 TypeError: Cannot set property 'componentId' of undefined
at n (main.web.js:3)
at resolveAsyncComponent (vue.runtime.js:2134)
at createComponent (vue.runtime.js:3643)
at _createElement (vue.runtime.js:3853)
at createElement (vue.runtime.js:3792)
at vm._c (vue.runtime.js:4132)
at Proxy.render (main.web.js:3)
at Vue$3.Vue._render (vue.runtime.js:4186)
at Vue$3.updateComponent (vue.runtime.js:2574)
at Watcher.get (vue.runtime.js:2915)
<div ref="test" style="margin-top: 20;width: 750; height: 750">
<gcanvas ref="canvas_holder" style="width:750;height:750;background-color:rgba(0,0,0,0.1)"></gcanvas>
</div>
script:
var GCanvas = require('weex-gcanvas'); //GCanvas
//var GCanvs=require('../js/src/gcanvas');
var Image = require('weex-gcanvas/gcanvasimage'); //GCanvasImage
//var Image=require('../js/src/gcanvasimage');
mounted () {
var ref = this.$refs.canvas_holder;
//创建gcanvas对象
var gcanvas = GCanvas.start(ref);
//获取context2D
var ctx = gcanvas.getContext('2d');
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 100, 100);
//rect
ctx.fillStyle = 'black';
ctx.fillRect(100, 100, 100, 100);
ctx.fillRect(25, 210, 700, 5);
//circle
ctx.fillStyle = '#12CC00';
ctx.arc(450, 200, 100, 0, Math.PI * 2, true);
ctx.fill();
//图片
var image = new Image();
image.onload = function(){
ctx.drawImage(image, 200, 0);
}
image.src = 'https://www.khronos.org/assets/uploads/ceimg/made/assets/uploads/apis/OpenGL-ES_100px_May16_225_75.png';
},
vue.runtime.js:565 TypeError: Cannot read property 'getContext' of undefined
at Vue$3.mounted (main.web.js:3)
at callHook (vue.runtime.js:2701)
at mountComponent (vue.runtime.js:2585)
at Vue$3.$mount (vue.runtime.js:7506)
at Vue$3.Vue._init (vue.runtime.js:4290)
at new Vue$3 (vue.runtime.js:4375)
at Object.<anonymous> (main.web.js:3)
at e (main.web.js:3)
at Object.<anonymous> (main.web.js:3)
at e (main.web.js:3)
就想知道这个插件还能正常使用吗?
版本太混乱了,js代码和native对应的实现很多不一样。