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:

  1. 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.

  2. Compatibility issue: Check the version of html2canvas you are using and make sure it is compatible with your browser.

  3. 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

html2canvasthen is not a function

原文地址: http://www.cveoy.top/t/topic/iTor 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录