perf: ♻️ Optimize mirror group

This commit is contained in:
viarotel 2023-11-10 17:30:19 +08:00
parent 48f6f5ba44
commit 81c007f9d0
3 changed files with 20 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<template>
<el-dropdown :disabled="loading" @command="handleMirror">
<el-dropdown :disabled="loading" @command="handleCommand">
<div class="">
<slot :loading="loading" />
</div>
@ -8,6 +8,12 @@
<el-dropdown-item v-for="item of 4" :key="item" :command="item">
{{ $t("device.control.mirror-group.open", { num: item }) }}
</el-dropdown-item>
<el-dropdown-item command="close">
<span class="" :title="$t('device.control.mirror-group.close.tips')">
{{ $t("device.control.mirror-group.close") }}
</span>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@ -33,14 +39,19 @@ export default {
preferenceData(...args) {
return this.$store.preference.getData(...args)
},
async handleMirror(open) {
console.log('handleMirror.open', open)
async handleCommand(command) {
console.log('handleCommand.command', command)
if (command === 'close') {
this.$adb.clearOverlayDisplayDevices(this.device.id)
return false
}
this.loading = true
try {
const res = await this.$scrcpy.mirrorGroup(this.device.id, {
open,
open: command,
title: ({ displayId }) =>
`${this.$store.device.getLabel(
this.device,
@ -48,7 +59,7 @@ export default {
args: this.scrcpyArgs(this.device.id),
})
console.log('handleMirror.res', res)
console.log('handleCommand.res', res)
res.forEach((item) => {
if (item.status === 'rejected') {

View File

@ -114,6 +114,8 @@
"device.control.mirror-group.name": "Mirror Group",
"device.control.mirror-group.tips": "When enabled, can mirror multiple simulated secondary displays and achieve multi-screen collaboration by operating each mirrored window. Note this requires ROM support and desktop mode enabled.",
"device.control.mirror-group.open": "Open {num} windows",
"device.control.mirror-group.close": "Close auxiliary display devices",
"device.control.mirror-group.close.tips": "Used to solve the issue of automatic closure failure after certain devices exit all control windows.",
"device.control.volume.name": "Volume",
"device.control.volume-up.name": "Volume Up",
"device.control.volume-down.name": "Volume Down",

View File

@ -112,6 +112,8 @@
"device.control.mirror-group.name": "多屏协同",
"device.control.mirror-group.tips": "开启后,可以同时镜像多个模拟辅助显示设备,并通过操作各个镜像窗口实现多屏协同功能。请注意,此功能需要手机 ROM 支持,并且必须开启强制使用桌面模式选项。",
"device.control.mirror-group.open": "开启 {num} 个窗口",
"device.control.mirror-group.close": "关闭辅助显示设备",
"device.control.mirror-group.close.tips": "用于解决某些机型退出所有控制窗口后自动关闭失败的问题",
"device.control.volume.name": "音量控制",
"device.control.volume-up.name": "增加音量",
"device.control.volume-down.name": "减小音量",