mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-22 04:49:42 +01:00
perf: ♻️ Optimize delete history logic
This commit is contained in:
parent
a06708ff19
commit
780e3b9abc
@ -1,43 +1,46 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center flex-none space-x-2">
|
<div class="flex items-center flex-none space-x-2">
|
||||||
<el-autocomplete
|
<div class="w-86 flex-none">
|
||||||
ref="elAutocompleteRef"
|
<el-autocomplete
|
||||||
v-model="formData.host"
|
v-if="!showAutocomplete"
|
||||||
placeholder="192.168.0.1"
|
ref="elAutocompleteRef"
|
||||||
clearable
|
v-model="formData.host"
|
||||||
:fetch-suggestions="fetchSuggestions"
|
placeholder="192.168.0.1"
|
||||||
class="!w-86 flex-none"
|
clearable
|
||||||
value-key="host"
|
:fetch-suggestions="fetchSuggestions"
|
||||||
@select="onSelect"
|
class="!w-full"
|
||||||
>
|
value-key="host"
|
||||||
<template #prepend>
|
@select="onSelect"
|
||||||
{{ $t('device.wireless.name') }}
|
>
|
||||||
</template>
|
<template #prepend>
|
||||||
|
{{ $t('device.wireless.name') }}
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<div
|
|
||||||
v-if="item.batch"
|
|
||||||
class="text-primary-500"
|
|
||||||
@click.stop="handleBatch"
|
|
||||||
>
|
|
||||||
{{ item.batch }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-else class="flex items-center">
|
|
||||||
<div class="flex-1 w-0">
|
|
||||||
{{ item.host }}
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="flex-none leading-none"
|
v-if="item.batch"
|
||||||
@click.prevent.stop="handleRemove(item)"
|
class="text-primary-500"
|
||||||
|
@click.stop="handleBatch"
|
||||||
>
|
>
|
||||||
<el-icon class="hover:text-primary-500 !active:text-primary-700">
|
{{ item.batch }}
|
||||||
<Close />
|
|
||||||
</el-icon>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
<div v-else class="flex items-center">
|
||||||
</el-autocomplete>
|
<div class="flex-1 w-0">
|
||||||
|
{{ item.host }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex-none leading-none"
|
||||||
|
@click.prevent.stop="handleRemove(item)"
|
||||||
|
>
|
||||||
|
<el-icon class="hover:text-primary-500 !active:text-primary-700">
|
||||||
|
<Close />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-autocomplete>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="text-gray-500 text-sm">
|
<div class="text-gray-500 text-sm">
|
||||||
:
|
:
|
||||||
@ -93,6 +96,8 @@ export default {
|
|||||||
host: lastWireless.host,
|
host: lastWireless.host,
|
||||||
port: lastWireless.port,
|
port: lastWireless.port,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showAutocomplete: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
@ -145,7 +150,18 @@ export default {
|
|||||||
this.wirelessList.splice(index, 1)
|
this.wirelessList.splice(index, 1)
|
||||||
|
|
||||||
this.$appStore.set('history.wireless', this.$toRaw(this.wirelessList))
|
this.$appStore.set('history.wireless', this.$toRaw(this.wirelessList))
|
||||||
|
|
||||||
|
this.reRenderAutocomplete()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async reRenderAutocomplete() {
|
||||||
|
this.showAutocomplete = true
|
||||||
|
|
||||||
|
await this.$nextTick()
|
||||||
|
|
||||||
|
this.showAutocomplete = false
|
||||||
|
},
|
||||||
|
|
||||||
async handleBatch() {
|
async handleBatch() {
|
||||||
if (this.loading) {
|
if (this.loading) {
|
||||||
return false
|
return false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user