门禁端网页独立出来,全屏功能修好
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
// import { remote } from 'electron'
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
// const setFullScreen = remote.getCurrentWindow().setFullScreen
|
||||
// const isFullScreen = remote.getCurrentWindow().isFullScreen
|
||||
// window.setFullScreen = setFullScreen
|
||||
// window.isFullScreen = isFullScreen
|
||||
window.addEventListener('message', function (e) {
|
||||
// 获取消息内容 data
|
||||
const { data } = e;
|
||||
console.log("[electron preload]", data)
|
||||
try {
|
||||
let message = JSON.parse(data);
|
||||
console.log(message)
|
||||
switch (message.action) {
|
||||
case 'fullscreen':
|
||||
ipcRenderer.send('toggle-fullscreen')
|
||||
break
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("err", err)
|
||||
}
|
||||
})
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
// document.getElementById("fullscreen-button").onclick = function () {
|
||||
// alert(1)
|
||||
// window.setFullScreen(!window.isFullScreen)
|
||||
// }
|
||||
})
|
||||
|
Reference in New Issue
Block a user