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

Update element.md

上级 0579241f
......@@ -243,4 +243,28 @@ getAttribute返回值从HBuilderX 3.93起,调整为string类型,不要使用
<!-- CUSTOMTYPEJSON.Element.methods.takeSnapshot.tutorial -->
截图的示例代码参考[hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/element-takesnapshot/element-takesnapshot.uvue)
\ No newline at end of file
```uts
// 找到需要截图节点
const view = uni.getElementById('snapshot-content')!
view.takeSnapshot({
success: function (res) {
// 打印截图文件临时路径
console.log(res.tempFilePath)
this.snapImage = res.tempFilePath
uni.showToast({
title: '截图成功,路径:' + res.tempFilePath,
icon: "none"
})
},
fail: function (res) {
console.log(res)
uni.showToast({
icon: 'error',
title: '截图失败'
})
}
})
```
完整示例代码参考[hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/element-takesnapshot/element-takesnapshot.uvue)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册