capture 截取屏幕元素组件
- Source:
Members
(inner) props
- Source:
Properties:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dom |
HTMLElement |
<optional> |
d.body
|
需要截取的Dom节点, 默认为document.body |
||||||||||||||||||||||||||||||||||||||||||||||||||
beforeCapture |
function |
<optional> |
截图前与执行函数,返回 Promise对象 |
|||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
html2canvas的配置项 Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
width |
Number |
<optional> |
element.width
|
截取dom的width |
||||||||||||||||||||||||||||||||||||||||||||||||||
height |
Number |
<optional> |
element.height
|
截取dom的height |
||||||||||||||||||||||||||||||||||||||||||||||||||
x |
Number |
<optional> |
ele.x-offset
|
canvas 的 原点 处于 dom原点的 水平距离(x距离),并在此位置开始渲染(原点为左上角) |
||||||||||||||||||||||||||||||||||||||||||||||||||
y |
Number |
<optional> |
ele.y-offset
|
canvas 的 原点 处于 dom原点的 垂直距离(y距离),并在此位置开始渲染(原点为左上角) |
||||||||||||||||||||||||||||||||||||||||||||||||||
windowWidth |
Number |
<optional> |
w.innerWidth
|
在渲染dom时的实时window.innerWidth, 可以手动修改 (修改此参数会让dom内一些根据windows大小而改变布局/大小的节点以此值来改变原来的位置和大小(例如某些并列的元素会被换行)) |
||||||||||||||||||||||||||||||||||||||||||||||||||
windowHeight |
Number |
<optional> |
w.innerHeight
|
在渲染dom时的实时window.innerHeight, 可以手动修改 |
||||||||||||||||||||||||||||||||||||||||||||||||||
scrollX |
Number |
<optional> |
element.scrollX
|
参数属性
(inner) slot
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
button |
string |
<optional> |
放置button 按钮的 slot |
插槽
Methods
(inner) _renderImg(h2c)
- Source:
内部渲染函数
Parameters:
Name | Type | Description |
---|---|---|
h2c |
function | html2canvas的功能函数 |
Events
on-capture
- Source:
点击抓取时派发的事件
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dom |
HTMLElement |
<optional> |
抓取的dom节点 |
on-output
- Source:
图片下载时派发的事件
Parameters:
Name | Type | Description |
---|---|---|
imgData |
string | 生成图片的Base64字符串 |