-
Notifications
You must be signed in to change notification settings - Fork 647
Description
因为直接用f-vue,在app端遇到canvas的context报错问题。我目前对照f-vue项目中的index.ts文件,做了一个适配,但还是报错。该从哪里下手。
//#ifdef APP-PLUS
context = uni.createCanvasContext('f2-canvas-app', this);
returnObject = {
...props,
children: toRawChildren($slots),
};
//#endif
// #ifndef APP-PLUS
context = canvasEl.getContext('2d');
returnObject = {
...props,
// context 内部创建,不能被覆盖
context,
children: toRawChildren($slots),
};
错误信息:
14:29:04.655 TypeError: Cannot read property 'createElement' of undefined
14:29:04.655 [JS Framework] Failed to execute the callback function:
TypeError: Cannot read property 'createElement' of undefined
14:29:04.686 reportJSException >>>> exception function:WEEX_CALL_JAVASCRIPT, exception:JavaScript execute error!Uncaught TypeError: Cannot read property 'createElement' of undefined
at OffscreenCanvasCreator2.getOrCreateCanvas (app-service.js:126215:36)
at TextService2.measureFont (app-service.js:127302:58)
at TextService2.measureText (app-service.js:127364:35)
at TextUpdater2.update (app-service.js:125034:54)
at DefaultStyleValueRegistry2.updateGeometry (app-service.js:123935:37)
at DefaultStyleValueRegistry2.processProperties (app-service.js:123790:16)
at DefaultStyleValueRegistry2.recalc (app-service.js:123919:16)
at RenderingService2.renderDisplayObject (app-service.js:126368:49)
at (app-service.js:126393:17)
at RenderingService2.renderDisplayObject (app-service.js:126392:55)