日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Uniapp 截图 适用于APP

發(fā)布時(shí)間:2024/3/24 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Uniapp 截图 适用于APP 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
<template> <view class="content"> <view class="nav-top">1.讓朋友的手機(jī)掃描下面的二維碼即可安裝</view> <view class="main"> <view class="lay1"><view class="line"></view></view> <view class="lay2"> <view class="qr"> <view class="qr-img"> <image src="../../static/logo.png" style="height: 200upx;width: 200upx;" ></image> </view> <view class="qr-txt">掃描二維碼下載安裝包</view> </view> </view> <view class="lay3"><view class="line"></view></view> </view> <view class="code-btn"> <view class="line-btn"><view class="btn" @tap="capture()">點(diǎn)擊保存至手機(jī)相冊(cè)</view></view> </view> </view> </template> <script> export default{ methods: { capture() { var pages = getCurrentPages(); var page = pages[pages.length - 1]; console.log("當(dāng)前頁(yè)"+pages.length-1);var bitmap=null; var currentWebview = page.$getAppWebview();bitmap = new plus.nativeObj.Bitmap('amway_img'); // 將webview內(nèi)容繪制到Bitmap對(duì)象中 currentWebview.draw(bitmap,function(){ console.log('截屏繪制圖片成功'); bitmap.save( "_doc/a.jpg" ,{} ,function(i){ console.log('保存圖片成功:'+JSON.stringify(i)); uni.saveImageToPhotosAlbum({ filePath: i.target, success: function () { bitmap.clear(); //銷毀Bitmap圖片 uni.showToast({ title: '保存圖片成功', mask: false, duration: 1500 }); } }); } ,function(e){ console.log('保存圖片失敗:'+JSON.stringify(e)); }); },function(e){ console.log('截屏繪制圖片失敗:'+JSON.stringify(e)); }); //currentWebview.append(amway_bit); } }, } </script> <style> page { background-color: #2d355c; } .content { } .nav-top { color: #ffffff; font-size: 35upx; text-align: center; margin: 20upx 0; } .main { position: relative; width: 100%; margin-top: 50upx; } .main .lay1 { position: absolute; top: 0; bottom: 0; right: 0; left: 0; z-index: 3000; } .main .lay1 .line { height: 100upx; width: 100%; border-radius: 50px; background-color: #e28f0b; margin-top: 100upx; } .lay2 { position: absolute; top: 0; bottom: 0; right: 0; left: 0; z-index: 4000; } .lay2 .qr { width: 70%; margin: 0 auto; height: 700upx; background-color: #3958ab; } .qr-img { text-align: center; padding-top: 50%; } .qr-txt { color: #ffffff; text-align: center; margin-top: 50upx; } .lay3 { position: absolute; top: 0; bottom: 0; right: 0; left: 0; z-index: 4000; text-align: center; } .lay3 .line { height: 100upx; width: 85%; border-radius: 50px; background-color: #e28f0b; margin: 40upx auto; box-shadow: #cccccc 0px 3px 10px; } .code-btn { width: 100%; color: #ffffff; height: 100%; text-align: center; } .line-btn { position: absolute; bottom: 200upx; left: 0upx; right: 0upx; width: 100%; display: flex; justify-content: center; } .btn { width: 400upx; padding: 35upx; background-color: #e28f0b; border-radius: 50px; } .btn:active{ background-color: #FEC607; } </style>

總結(jié)

以上是生活随笔為你收集整理的Uniapp 截图 适用于APP的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。