zoukankan      html  css  js  c++  java
  • 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%'} //设置截屏区域
    });

  • 相关阅读:
    vuex插件
    axios
    token登录验证
    mysql模糊查询
    Koa2+Mysql搭建简易博客
    正则匹配器
    编码
    Maven学习
    防止重复提交保证幂等的几种解决方案
    策略模式优化if-else
  • 原文地址:https://www.cnblogs.com/jyc226/p/14950056.html
Copyright © 2011-2022 走看看