html2canvasthen is not a function
The error "html2canvas(...).then is not a function" occurs when you try to use the .then() method on a variable or object that is not a Promise.
The possible reasons for this error are:
-
Incorrect usage of html2canvas library: Make sure you are using the html2canvas library correctly. Ensure that you have included the library script in your HTML file and have called the
html2canvas()function properly. -
Compatibility issue: Check the version of html2canvas you are using and make sure it is compatible with your browser.
-
Promise support: Confirm that your browser supports Promises. If you are using an outdated browser, it might not have support for Promises. In this case, you may need to use a polyfill or update your browser.
Here's an example of how to properly use html2canvas with a Promise:
html2canvas(document.querySelector("#elementId")).then(function(canvas) {
// Use the generated canvas here
}).catch(function(error) {
// Handle any error that occurred during canvas generation
});
Make sure you are following a similar structure and that the .then() function is being called on the html2canvas() function correctly
原文地址: http://www.cveoy.top/t/topic/iTor 著作权归作者所有。请勿转载和采集!