提交 c1f3b3a5 编写于 作者: 杜庆泉's avatar 杜庆泉

takesnapshot 不需要再手动转换类型

上级 b81f8530
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<button class="uni-btn" @click="changeViewStyle"> <button class="uni-btn" @click="changeViewStyle">
修改 view 宽高及背景色 修改 view 宽高及背景色
</button> </button>
<button class="uni-btn btn-TakeSnapshot" type="primary" @tap="takeSnapshotClick"> <button class="uni-btn btn-TakeSnapshot" type="primary" @tap="takeSnapshotClick">
点击截图 点击截图
</button> </button>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
takeSnapshotClick() { takeSnapshotClick() {
const view = uni.getElementById('snapshot-content')! const view = uni.getElementById('snapshot-content')!
view.takeSnapshot({ view.takeSnapshot({
success: function (res : TakeSnapshotSuccess) { success: function (res) {
console.log(res.tempFilePath) console.log(res.tempFilePath)
this.snapImage = res.tempFilePath this.snapImage = res.tempFilePath
uni.showToast({ uni.showToast({
...@@ -45,14 +45,14 @@ ...@@ -45,14 +45,14 @@
icon: "none" icon: "none"
}) })
}, },
fail: function (res : TakeSnapshotFail) { fail: function (res) {
console.log(res) console.log(res)
uni.showToast({ uni.showToast({
icon: 'error', icon: 'error',
title: '截图失败' title: '截图失败'
}) })
} }
} as TakeSnapshotOptions) })
}, },
saveToAlbum(e : TouchEvent) { saveToAlbum(e : TouchEvent) {
// console.log(e.currentTarget!.getAttribute("src")); // console.log(e.currentTarget!.getAttribute("src"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册