h5项目,pc端访问正常,iphone12真机访问,连续多次报错Uncaught (in promise){},以致真机上功能受到影响
1,使用插件,预览pdf文件时,电脑端访问正常,但真机上显示不出来。vconsole报错如下:
Uncaught (in promise) {
"name": "TypeError",
"message": "null is not an object (evaluating 'e.createImageData')",
"stack": "m@http://xxx/assets/Pdf.b75e6e4b.js:1:100861\npaintInlineImageXObject@http://xxx/assets/Pdf.b75e6e4b.js:1:131756\npaintImageXObject@http://xxx.cn/assets/Pdf.b75e6e4b.js:1:131124\nexecuteOperatorList@http://xxx.cn/assets/Pdf.b75e6e4b.js:1:107525\n@http://xxx.cn/assets/Pdf.b75e6e4b.js:1:58820\nasyncFunctionResume@[native code]\n_next@[native code]\n@http://xxx.cn/assets/Pdf.b75e6e4b.js:1:58644"
}
2,使用插件vue-esign,进行电子签名,电脑端访问正常,但真机上操作时好时坏。vconsole报错如下:
Uncaught (in promise) {
"name": "TypeError",
"message": "null is not an object (evaluating 'this.canvasTxt.scale')",
"stack": "$_resizeHandler@http://xxx.cn/assets/index.11e667a6.js:6:56433\n$_resizeHandler@[native code]\nmounted@http://xxx.cn/assets/index.11e667a6.js:6:56169\nmounted@[native code]\ncallWithErrorHandling@http://xxx.cn/assets/index.11e667a6.js:1:23427\ncallWithAsyncErrorHandling@http://xxx.cn/assets/index.11e667a6.js:1:23569\n@http://xxx.cn/assets/index.11e667a6.js:1:45186\nflushPostFlushCbs@http://xxx.cn/assets/index.11e667a6.js:1:25968\nflushJobs@http://xxx.cn/assets/index.11e667a6.js:1:26504\npromiseReactionJob@[native code]"
}
解决方案:
最简单的 就是在方法后面加上.catch((e) => {}),以上2个问题都通过这个方法解决了