简体   繁体   中英

ZK: dom-to-image screenshot script not working?

Hi I am new to ZK and I am struggling to get my script working. I have tried creating testing the script on a HTML page which worked fine but it does not work in my ZK page

 <script> function captureScreen() { const screenshotTarget = document.body; domtoimage.toBlob(screenshotTarget).then(function (blob) { window.saveAs(blob, 'my-node.png'); }); alert("alert box!!"); } </script>

the alert box was added as a test and it displays fine, however the script to take and download a screen capture does not.

I guess you use this dom-to-image . Do you see any js error in your browser console?

In my 1st try, I found the error saveAs is not a function . Then I found I need to include FileSaver .

I have created a trivial example at https://github.com/zkoss-demo/gettingStarted/tree/dom-to-image

If it doesn't help you locate the root cause, please attach related details including error message, zul page source...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM