mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-17 10:58:38 +01:00
perf: ⚡️ Optimize the stability of options that need to dynamically obtain parameters in preference settings
This commit is contained in:
parent
98009801a5
commit
39bbc9850b
@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.25.4",
|
"version": "1.25.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@9.4.0+sha1.9217c800d4ab947a7aee520242a7b70d64fc7638",
|
"packageManager": "pnpm@9.12.3",
|
||||||
"description": "Scrcpy Powered by Electron",
|
"description": "Scrcpy Powered by Electron",
|
||||||
"author": "viarotel",
|
"author": "viarotel",
|
||||||
"homepage": "https://github.com/viarotel-org/escrcpy",
|
"homepage": "https://github.com/viarotel-org/escrcpy",
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
v-bind="{
|
v-bind="{
|
||||||
collapseProps: { accordion: true },
|
collapseProps: { accordion: true },
|
||||||
excludes: ['common'],
|
excludes: ['common'],
|
||||||
|
deviceScope: device.id,
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
v-bind="{ clearable: true, ...(data.props || {}) }"
|
v-bind="{ clearable: true, ...(data.props || {}) }"
|
||||||
v-model="selectValue"
|
v-model="selectValue"
|
||||||
class="!w-full"
|
class="!w-full"
|
||||||
|
@click="getDeviceOptions"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in options"
|
v-for="(item, index) in options"
|
||||||
@ -15,6 +16,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getDeviceId } from '../helper.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -56,21 +59,16 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
deviceScope: {
|
|
||||||
handler(value) {
|
|
||||||
if (value === 'global') {
|
|
||||||
this.deviceOptions = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getDeviceOptions()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
async getDeviceOptions() {
|
async getDeviceOptions() {
|
||||||
const res = await this.$scrcpy.getEncoders(this.deviceScope)
|
const deviceId = getDeviceId(this.deviceScope)
|
||||||
|
|
||||||
|
if (!deviceId) {
|
||||||
|
this.deviceOptions = []
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await this.$scrcpy.getEncoders(deviceId)
|
||||||
|
|
||||||
this.deviceOptions = res?.audio?.map((item) => {
|
this.deviceOptions = res?.audio?.map((item) => {
|
||||||
const value = `${item.decoder} & ${item.encoder}`
|
const value = `${item.decoder} & ${item.encoder}`
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
}"
|
}"
|
||||||
v-model="selectValue"
|
v-model="selectValue"
|
||||||
class="!w-full"
|
class="!w-full"
|
||||||
|
@click="getDeviceOptions"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in options"
|
v-for="(item, index) in options"
|
||||||
@ -18,6 +19,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getDeviceId } from '../helper.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -56,21 +59,16 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
deviceScope: {
|
|
||||||
handler(value) {
|
|
||||||
if (value === 'global') {
|
|
||||||
this.deviceOptions = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getDeviceOptions()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
async getDeviceOptions() {
|
async getDeviceOptions() {
|
||||||
const res = await this.$adb.display(this.deviceScope)
|
const deviceId = getDeviceId(this.deviceScope)
|
||||||
|
|
||||||
|
if (!deviceId) {
|
||||||
|
this.deviceOptions = []
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await this.$adb.display(deviceId)
|
||||||
|
|
||||||
this.deviceOptions
|
this.deviceOptions
|
||||||
= res?.map((item) => {
|
= res?.map((item) => {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
v-bind="{ clearable: true, ...(data.props || {}) }"
|
v-bind="{ clearable: true, ...(data.props || {}) }"
|
||||||
v-model="selectValue"
|
v-model="selectValue"
|
||||||
class="!w-full"
|
class="!w-full"
|
||||||
|
@click="getDeviceOptions"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in options"
|
v-for="(item, index) in options"
|
||||||
@ -15,6 +16,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getDeviceId } from '../helper.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -56,21 +59,16 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
deviceScope: {
|
|
||||||
handler(value) {
|
|
||||||
if (value === 'global') {
|
|
||||||
this.deviceOptions = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getDeviceOptions()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
async getDeviceOptions() {
|
async getDeviceOptions() {
|
||||||
const res = await this.$scrcpy.getEncoders(this.deviceScope)
|
const deviceId = getDeviceId(this.deviceScope)
|
||||||
|
|
||||||
|
if (!deviceId) {
|
||||||
|
this.deviceOptions = []
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await this.$scrcpy.getEncoders(deviceId)
|
||||||
|
|
||||||
this.deviceOptions = res?.video?.map((item) => {
|
this.deviceOptions = res?.video?.map((item) => {
|
||||||
const value = `${item.decoder} & ${item.encoder}`
|
const value = `${item.decoder} & ${item.encoder}`
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import { useDeviceStore } from '$/store/device/index.js'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备ID
|
||||||
|
* @param {*} scope
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getDeviceId(scope) {
|
||||||
|
let value = scope
|
||||||
|
|
||||||
|
if (value === 'global') {
|
||||||
|
value = useDeviceStore().list[0]?.id
|
||||||
|
}
|
||||||
|
|
||||||
|
return value
|
||||||
|
}
|
@ -122,8 +122,6 @@ export default {
|
|||||||
placeholder: 'preferences.video.display.placeholder',
|
placeholder: 'preferences.video.display.placeholder',
|
||||||
options: [
|
options: [
|
||||||
{ label: '0', value: '0' },
|
{ label: '0', value: '0' },
|
||||||
{ label: '1', value: '1' },
|
|
||||||
{ label: '2', value: '2' },
|
|
||||||
],
|
],
|
||||||
props: {
|
props: {
|
||||||
filterable: true,
|
filterable: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user