优化批量执行指令和windows接入发送组合键

This commit is contained in:
dushixiang
2021-01-23 22:41:44 +08:00
parent ba982dacd0
commit 038f59d155
10 changed files with 290 additions and 91 deletions

View File

@ -78,7 +78,7 @@ export const cloneObj = (obj, ignoreFields) => {
export function download(url) {
let aElement = document.createElement('a');
aElement.setAttribute('download', '');
aElement.setAttribute('target', '_blank');
// aElement.setAttribute('target', '_blank');
aElement.setAttribute('href', url);
aElement.click();
}
@ -176,4 +176,37 @@ export function difference(a, b) {
let aSet = new Set(a)
let bSet = new Set(b)
return Array.from(new Set(a.concat(b).filter(v => !aSet.has(v) || !bSet.has(v))))
}
export function requestFullScreen(element) {
// 判断各种浏览器,找到正确的方法
const requestMethod = element.requestFullScreen || //W3C
element.webkitRequestFullScreen || //FireFox
element.mozRequestFullScreen || //Chrome等
element.msRequestFullScreen; //IE11
if (requestMethod) {
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
const wScript = new window.ActiveXObject("WScript.Shell");
if (wScript !== null) {
wScript.SendKeys("{F11}");
}
}
}
//退出全屏 判断浏览器种类
export function exitFull() {
// 判断各种浏览器,找到正确的方法
const exitMethod = document.exitFullscreen || //W3C
document.mozCancelFullScreen || //FireFox
document.webkitExitFullscreen || //Chrome等
document.webkitExitFullscreen; //IE11
if (exitMethod) {
exitMethod.call(document);
} else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
const wScript = new window.ActiveXObject("WScript.Shell");
if (wScript !== null) {
wScript.SendKeys("{F11}");
}
}
}