获取屏幕信息

This commit is contained in:
gaoshuaixing
2021-10-12 16:18:33 +08:00
parent c51051655c
commit fc4c091f0d
7 changed files with 153 additions and 11 deletions

View File

@@ -47,7 +47,12 @@ export const constantRouterMap = [
path: '/demo/powermonitor/index',
name: 'DemoPowerMonitorIndex',
component: () => import('@/views/demo/powermonitor/Index')
},
},
{
path: '/demo/screen/index',
name: 'DemoScreenIndex',
component: () => import('@/views/demo/screen/Index')
},
{
path: '/demo/shortcut/index',
name: 'DemoShortcutIndex',

View File

@@ -59,7 +59,13 @@ export default {
title: '电源监控',
pageName: 'DemoPowerMonitorIndex',
params: {}
},
},
'menu_404' : {
icon: 'profile',
title: '屏幕信息',
pageName: 'DemoScreenIndex',
params: {}
},
'menu_500' : {
icon: 'profile',
title: '软件调用',

View File

@@ -1,5 +1,5 @@
<template>
<div id="app-demo-window-view">
<div id="app-demo-notification">
<div class="one-block-1">
<span>
1. 弹出桌面通知
@@ -72,7 +72,7 @@ export default {
};
</script>
<style lang="less" scoped>
#app-demo-window-view {
#app-demo-notification {
padding: 0px 10px;
text-align: left;
width: 100%;

View File

@@ -1,5 +1,5 @@
<template>
<div id="app-demo-window-view">
<div id="app-demo-powermonitor">
<div class="one-block-1">
<span>
1. 监控电源状态
@@ -42,7 +42,7 @@ export default {
};
</script>
<style lang="less" scoped>
#app-demo-window-view {
#app-demo-powermonitor {
padding: 0px 10px;
text-align: left;
width: 100%;

View File

@@ -0,0 +1,66 @@
<template>
<div id="app-demo-screen">
<div class="one-block-1">
<span>
1. 屏幕信息
</span>
</div>
<div class="one-block-2">
<a-space>
<a-button @click="getScreen(0)">获取当前鼠标位置</a-button>
<a-button @click="getScreen(1)">获取主屏幕</a-button>
<a-button @click="getScreen(2)">获取所有屏幕</a-button>
</a-space>
</div>
<div class="one-block-1">
<span>
结果
</span>
</div>
<div class="one-block-2">
<a-descriptions title="">
<a-descriptions-item v-for="(info, index) in data" :key="index" :label="info.title" >
{{ info.desc }}
</a-descriptions-item>
</a-descriptions>
</div>
</div>
</template>
<script>
export default {
data() {
return {
data: [],
};
},
mounted () {
this.init();
},
methods: {
init () {
const self = this;
self.$ipc.on('example.getScreen', (event, result) => {
self.data = result;
})
},
getScreen (index) {
this.$ipc.send('example.getScreen', index);
},
}
};
</script>
<style lang="less" scoped>
#app-demo-screen {
padding: 0px 10px;
text-align: left;
width: 100%;
.one-block-1 {
font-size: 16px;
padding-top: 10px;
}
.one-block-2 {
padding-top: 10px;
}
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<div id="app-demo-window-view">
<div id="app-demo-window">
<div class="one-block-1">
<span>
1. 新窗口中加载web内容
@@ -50,7 +50,7 @@ export default {
};
</script>
<style lang="less" scoped>
#app-demo-window-view {
#app-demo-window {
padding: 0px 10px;
text-align: left;
width: 100%;