• uniapp截屏


    var ws=null;
    ws=this.$mp.page.$getAppWebview();
    var bitmap=null;
    bitmap = new plus.nativeObj.Bitmap('test');
    // 将webview内容绘制到Bitmap对象中
    uni.showLoading({
    // title: '加载中'
    });
    ws.draw(bitmap,function(){
    var bitmaps=plus.nativeObj.Bitmap.getItems();;
    bitmap.save( "_doc/a.jpg",{},function(i){
    uni.saveImageToPhotosAlbum({
    filePath: i.target,
    success: function () {
    bitmap.clear();
    setTimeout(()=>{
    uni.hideLoading();
    uni.showToast({
    title: "截屏成功",
    icon: "none"
    });
    },2000)
    },
    })
    } ,
    function(e){
    console.log('保存图片失败:'+JSON.stringify(e));
    });
    },function(e){
    console.log('截屏绘制图片失败:'+JSON.stringify(e));
    },{check:true, // 设置为检测白屏
    clip:{top:'0',left:'0',height:'100%','100%'} //设置截屏区域
    });

  • 相关阅读:
    winfrom 获取当前系统时间
    netcore3.1API+efcore快速搭建
    php
    php
    php
    php-array的相关函数使用
    php-正则表达式
    vim的复制与粘贴
    vim的多窗口和文件切换操作
    laravel教程中出现500问题
  • 原文地址:https://www.cnblogs.com/jyc226/p/14950056.html
Copyright © 2020-2023  润新知