utools.ubrowser.screenshot 的 API 是用于截取当前 ubrowser 页面的截图,具体使用方式如下:

  1. 在你的 utools 插件中,调用 utools.ubrowser.screenshot 方法。
utools.ubrowser.screenshot()
  1. 调用方法后,会自动在 ubrowser 页面上截取当前页面的截图,并且返回截图的 Base64 编码。
{
  code: 200, // 返回码,200 表示成功
  data: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...', // 截图的 Base64 编码
}
  1. 接下来,你可以将 Base64 编码转换为图片,或者在你的插件中直接使用 Base64 编码。
const imgData = response.data;
const img = new Image();
img.src = imgData;
document.body.appendChild(img);
  1. 至此,你已经成功使用了 utools.ubrowser.screenshot 的 API,截取了当前 ubrowser 页面的截图。
Utools ubrowser.screenshot API 使用教程

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

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