Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
unidocs-uni-app-x-zh
提交
7cf4d168
U
unidocs-uni-app-x-zh
项目概览
DCloud
/
unidocs-uni-app-x-zh
通知
144
Star
2
Fork
33
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
9
列表
看板
标记
里程碑
合并请求
11
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
unidocs-uni-app-x-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
9
Issue
9
列表
看板
标记
里程碑
合并请求
11
合并请求
11
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7cf4d168
编写于
1月 04, 2024
作者:
D
DCloud_LXH
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Element -> UniElement
上级
6474bb4e
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
292 addition
and
277 deletion
+292
-277
docs/.vuepress/utils/customTypeJson.json
docs/.vuepress/utils/customTypeJson.json
+1
-1
docs/.vuepress/utils/utsApiJson.json
docs/.vuepress/utils/utsApiJson.json
+1
-1
docs/.vuepress/utils/utsComJson.json
docs/.vuepress/utils/utsComJson.json
+1
-1
docs/.vuepress/utils/utsUnicloudApiJson.json
docs/.vuepress/utils/utsUnicloudApiJson.json
+1
-1
docs/.vuepress/utils/vueJson.json
docs/.vuepress/utils/vueJson.json
+1
-1
docs/dom/_sidebar.md
docs/dom/_sidebar.md
+1
-1
docs/dom/element.md
docs/dom/element.md
+1
-271
docs/dom/unielement.md
docs/dom/unielement.md
+285
-0
未找到文件。
docs/.vuepress/utils/customTypeJson.json
浏览文件 @
7cf4d168
此差异已折叠。
点击以展开。
docs/.vuepress/utils/utsApiJson.json
浏览文件 @
7cf4d168
此差异已折叠。
点击以展开。
docs/.vuepress/utils/utsComJson.json
浏览文件 @
7cf4d168
此差异已折叠。
点击以展开。
docs/.vuepress/utils/utsUnicloudApiJson.json
浏览文件 @
7cf4d168
此差异已折叠。
点击以展开。
docs/.vuepress/utils/vueJson.json
浏览文件 @
7cf4d168
此差异已折叠。
点击以展开。
docs/dom/_sidebar.md
浏览文件 @
7cf4d168
*
[
DOM概述
](
README.md
)
*
[
Element
](
element.md
)
*
[
UniElement
](
uni
element.md
)
*
[
DOMRect
](
domrect.md
)
*
[
CSSStyleDeclaration
](
cssstyledeclaration.md
)
*
[
DrawableContext
](
drawablecontext.md
)
\ No newline at end of file
docs/dom/element.md
浏览文件 @
7cf4d168
## Element
<!-- CUSTOMTYPEJSON.Element.description -->
<!-- CUSTOMTYPEJSON.Element.extends -->
<!-- CUSTOMTYPEJSON.Element.param -->
### 方法
<!-- CUSTOMTYPEJSON.Element.methods.getNodeId.name -->
<!-- CUSTOMTYPEJSON.Element.methods.getNodeId.description -->
<!-- CUSTOMTYPEJSON.Element.methods.getNodeId.param -->
<!-- CUSTOMTYPEJSON.Element.methods.getNodeId.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.getNodeId.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.getNodeId.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.appendChild.name -->
<!-- CUSTOMTYPEJSON.Element.methods.appendChild.description -->
<!-- CUSTOMTYPEJSON.Element.methods.appendChild.param -->
<!-- CUSTOMTYPEJSON.Element.methods.appendChild.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.appendChild.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.appendChild.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.insertBefore.name -->
<!-- CUSTOMTYPEJSON.Element.methods.insertBefore.description -->
<!-- CUSTOMTYPEJSON.Element.methods.insertBefore.param -->
<!-- CUSTOMTYPEJSON.Element.methods.insertBefore.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.insertBefore.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.insertBefore.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.setAttribute.name -->
<!-- CUSTOMTYPEJSON.Element.methods.setAttribute.description -->
**注意**
setAttribute从HBuilderX 3.93起,调整为只能保存string类型属性值,需要保存其它类型数据请使用dataset属性。
<!-- CUSTOMTYPEJSON.Element.methods.setAttribute.param -->
<!-- CUSTOMTYPEJSON.Element.methods.setAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.setAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.setAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.getAttribute.name -->
<!-- CUSTOMTYPEJSON.Element.methods.getAttribute.description -->
**注意**
getAttribute返回值从HBuilderX 3.93起,调整为string类型,不要使用此方法获取非string类型的属性值。如有非string需求,请使用对象的点操作符直接访问dateset属性,不通过getAttribute方法。
<!-- CUSTOMTYPEJSON.Element.methods.getAttribute.param -->
<!-- CUSTOMTYPEJSON.Element.methods.getAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.getAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.getAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.hasAttribute.name -->
<!-- CUSTOMTYPEJSON.Element.methods.hasAttribute.description -->
<!-- CUSTOMTYPEJSON.Element.methods.hasAttribute.param -->
<!-- CUSTOMTYPEJSON.Element.methods.hasAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.hasAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.hasAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.removeAttribute.name -->
<!-- CUSTOMTYPEJSON.Element.methods.removeAttribute.description -->
<!-- CUSTOMTYPEJSON.Element.methods.removeAttribute.param -->
<!-- CUSTOMTYPEJSON.Element.methods.removeAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.removeAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.removeAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.getBoundingClientRect.name -->
<!-- CUSTOMTYPEJSON.Element.methods.getBoundingClientRect.description -->
<!-- CUSTOMTYPEJSON.Element.methods.getBoundingClientRect.param -->
<!-- CUSTOMTYPEJSON.Element.methods.getBoundingClientRect.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.getBoundingClientRect.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.getBoundingClientRect.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.getDrawableContext.name -->
<!-- CUSTOMTYPEJSON.Element.methods.getDrawableContext.description -->
<!-- CUSTOMTYPEJSON.Element.methods.getDrawableContext.param -->
<!-- CUSTOMTYPEJSON.Element.methods.getDrawableContext.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.getDrawableContext.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.getDrawableContext.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.addEventListener.name -->
<!-- CUSTOMTYPEJSON.Element.methods.addEventListener.description -->
<!-- CUSTOMTYPEJSON.Element.methods.addEventListener.param -->
<!-- CUSTOMTYPEJSON.Element.methods.addEventListener.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.addEventListener.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.addEventListener.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.removeEventListener.name -->
<!-- CUSTOMTYPEJSON.Element.methods.removeEventListener.description -->
<!-- CUSTOMTYPEJSON.Element.methods.removeEventListener.param -->
<!-- CUSTOMTYPEJSON.Element.methods.removeEventListener.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.removeEventListener.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.removeEventListener.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.removeChild.name -->
<!-- CUSTOMTYPEJSON.Element.methods.removeChild.description -->
<!-- CUSTOMTYPEJSON.Element.methods.removeChild.param -->
<!-- CUSTOMTYPEJSON.Element.methods.removeChild.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.removeChild.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.removeChild.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.remove.name -->
<!-- CUSTOMTYPEJSON.Element.methods.remove.description -->
<!-- CUSTOMTYPEJSON.Element.methods.remove.param -->
<!-- CUSTOMTYPEJSON.Element.methods.remove.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.remove.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.remove.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.dispatchEvent.name -->
<!-- CUSTOMTYPEJSON.Element.methods.dispatchEvent.description -->
<!-- CUSTOMTYPEJSON.Element.methods.dispatchEvent.param -->
<!-- CUSTOMTYPEJSON.Element.methods.dispatchEvent.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.dispatchEvent.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.dispatchEvent.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollTo.name -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollTo.description -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollTo.param -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollTo.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollTo.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollTo.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollBy.name -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollBy.description -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollBy.param -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollBy.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollBy.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.scrollBy.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.focus.name -->
<!-- CUSTOMTYPEJSON.Element.methods.focus.description -->
<!-- CUSTOMTYPEJSON.Element.methods.focus.param -->
<!-- CUSTOMTYPEJSON.Element.methods.focus.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.focus.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.focus.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.blur.name -->
<!-- CUSTOMTYPEJSON.Element.methods.blur.description -->
<!-- CUSTOMTYPEJSON.Element.methods.blur.param -->
<!-- CUSTOMTYPEJSON.Element.methods.blur.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.blur.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.blur.tutorial -->
<!-- CUSTOMTYPEJSON.Element.methods.takeSnapshot.name -->
<!-- CUSTOMTYPEJSON.Element.methods.takeSnapshot.description -->
<!-- CUSTOMTYPEJSON.Element.methods.takeSnapshot.param -->
<!-- CUSTOMTYPEJSON.Element.methods.takeSnapshot.returnValue -->
<!-- CUSTOMTYPEJSON.Element.methods.takeSnapshot.compatibility -->
<!-- CUSTOMTYPEJSON.Element.methods.takeSnapshot.tutorial -->
```
ts
// 找到需要截图节点
const
view
=
uni
.
getElementById
(
'
snapshot-content
'
)
!
// 进行截图
view
.
takeSnapshot
({
success
:
function
(
res
)
{
// 打印截图文件临时路径
console
.
log
(
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
)
*
截图会在应用沙盒目录的cache目录产生临时文件,位置
[
详见
](
../api/file-system-spec.md#cache
)
。
*
app端如需主动删除临时文件,使用
[
uni.getFileSystemManager
](
../api/get-file-system-manager.md
)
。
\ No newline at end of file
文档已移至:
[
UniElement
](
./unielement.md
)
\ No newline at end of file
docs/dom/unielement.md
0 → 100644
浏览文件 @
7cf4d168
## UniElement
<!-- CUSTOMTYPEJSON.UniElement.description -->
<!-- CUSTOMTYPEJSON.UniElement.extends -->
<!-- CUSTOMTYPEJSON.UniElement.param -->
<!-- CUSTOMTYPEJSON.UniElement.example -->
### UniElement 的方法 @unielement-methods
<!-- CUSTOMTYPEJSON.UniElement.methods.takeSnapshot.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.takeSnapshot.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.takeSnapshot.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.takeSnapshot.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.takeSnapshot.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.takeSnapshot.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.appendChild.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.appendChild.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.appendChild.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.appendChild.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.appendChild.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.appendChild.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.insertBefore.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.insertBefore.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.insertBefore.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.insertBefore.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.insertBefore.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.insertBefore.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.setAttribute.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.setAttribute.description -->
**注意**
setAttribute从HBuilderX 3.93起,调整为只能保存string类型属性值,需要保存其它类型数据请使用dataset属性。
<!-- CUSTOMTYPEJSON.UniElement.methods.setAttribute.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.setAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.setAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.setAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getAttribute.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getAttribute.description -->
**注意**
getAttribute返回值从HBuilderX 3.93起,调整为string类型,不要使用此方法获取非string类型的属性值。如有非string需求,请使用对象的点操作符直接访问dateset属性,不通过getAttribute方法。
<!-- CUSTOMTYPEJSON.UniElement.methods.getAttribute.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.hasAttribute.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.hasAttribute.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.hasAttribute.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.hasAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.hasAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.hasAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeAttribute.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeAttribute.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeAttribute.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getBoundingClientRect.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getBoundingClientRect.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getBoundingClientRect.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getBoundingClientRect.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getBoundingClientRect.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getBoundingClientRect.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getDrawableContext.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getDrawableContext.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getDrawableContext.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getDrawableContext.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getDrawableContext.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.getDrawableContext.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.addEventListener.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.addEventListener.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.addEventListener.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.addEventListener.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.addEventListener.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.addEventListener.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeEventListener.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeEventListener.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeEventListener.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeEventListener.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeEventListener.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeEventListener.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeChild.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeChild.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeChild.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeChild.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeChild.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.removeChild.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.remove.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.remove.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.remove.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.remove.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.remove.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.remove.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.dispatchEvent.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.dispatchEvent.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.dispatchEvent.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.dispatchEvent.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.dispatchEvent.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.dispatchEvent.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollTo.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollTo.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollTo.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollTo.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollTo.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollTo.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollBy.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollBy.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollBy.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollBy.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollBy.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.scrollBy.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelector.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelector.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelector.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelector.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelector.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelector.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelectorAll.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelectorAll.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelectorAll.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelectorAll.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelectorAll.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.querySelectorAll.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.focus.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.focus.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.focus.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.focus.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.focus.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.focus.tutorial -->
<!-- CUSTOMTYPEJSON.UniElement.methods.blur.name -->
<!-- CUSTOMTYPEJSON.UniElement.methods.blur.description -->
<!-- CUSTOMTYPEJSON.UniElement.methods.blur.param -->
<!-- CUSTOMTYPEJSON.UniElement.methods.blur.returnValue -->
<!-- CUSTOMTYPEJSON.UniElement.methods.blur.compatibility -->
<!-- CUSTOMTYPEJSON.UniElement.methods.blur.tutorial -->
```
ts
// 找到需要截图节点
const
view
=
uni
.
getElementById
(
'
snapshot-content
'
)
!
// 进行截图
view
.
takeSnapshot
({
success
:
function
(
res
)
{
// 打印截图文件临时路径
console
.
log
(
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
)
*
截图会在应用沙盒目录的cache目录产生临时文件,位置
[
详见
](
../api/file-system-spec.md#cache
)
。
*
app端如需主动删除临时文件,使用
[
uni.getFileSystemManager
](
../api/get-file-system-manager.md
)
。
\ No newline at end of file
LXH_1129
@qq_42428342
mentioned in commit
7f210c16
·
1月 06, 2024
mentioned in commit
7f210c16
mentioned in commit 7f210c1676890a91d402cbea62c87e509495ced3
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录