File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ export type screenShotType = {
104
104
imgSrc ?: string ; // 截图内容,默认为false
105
105
loadCrossImg ?: boolean ; // 加载跨域图片状态
106
106
proxyUrl ?: string ; // 代理服务器地址
107
+ useCORS ?: boolean ; // 是否启用跨域
107
108
screenShotDom ?: HTMLElement | HTMLDivElement | HTMLCanvasElement ; // 需要进行截图的容器
108
109
cropBoxInfo ?: { x : number ; y : number ; w : number ; h : number } ; // 是否加载默认的裁剪框
109
110
wrcReplyTime ?: number ; // webrtc捕捉屏幕响应时间,默认为500ms
Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ export default class ScreenShot {
120
120
// 鼠标是否在裁剪框内
121
121
private mouseInsideCropBox = false ;
122
122
private proxyUrl : undefined | string = undefined ;
123
+ private useCORS = false ;
123
124
private drawStatus = false ;
124
125
// webrtc模式下的屏幕流数据
125
126
private captureStream : MediaStream | null = null ;
@@ -266,7 +267,8 @@ export default class ScreenShot {
266
267
// html2canvas截屏
267
268
html2canvas ( this . screenShotDom ? this . screenShotDom : document . body , {
268
269
onclone : this . loadCrossImg ? drawCrossImg : undefined ,
269
- proxy : this . proxyUrl
270
+ proxy : this . proxyUrl ,
271
+ useCORS : this . useCORS
270
272
} )
271
273
. then ( canvas => {
272
274
// 装载截图的dom为null则退出
@@ -1018,6 +1020,9 @@ export default class ScreenShot {
1018
1020
if ( options ?. proxyUrl ) {
1019
1021
this . proxyUrl = options . proxyUrl ;
1020
1022
}
1023
+ if ( options ?. useCORS ) {
1024
+ this . useCORS = options . useCORS ;
1025
+ }
1021
1026
// 设置截图容器的位置信息
1022
1027
if ( options ?. position != null ) {
1023
1028
if ( options . position ?. top != null ) {
You can’t perform that action at this time.
0 commit comments