|
|
@@ -3,7 +3,7 @@ import { computed, ref, watch } from 'vue'
|
|
|
|
|
|
const name = ref('')
|
|
|
const room = ref('')
|
|
|
-const url = ref('mqtt://127.0.0.1:49800')
|
|
|
+const url = ref(localStorage.getItem('URL') || '')
|
|
|
const props = defineProps<{ modelValue: string }>()
|
|
|
const err = computed(() => props.modelValue)
|
|
|
const emit = defineEmits<{(evt: 'update:modelValue', value: string): void
|
|
|
@@ -18,8 +18,11 @@ function titleEvent(type: string) {
|
|
|
window.$electron?.send(type)
|
|
|
}
|
|
|
|
|
|
-watch([ name, room, url ], () => {
|
|
|
- if (name.value && room.value && url.value) emit('update:modelValue', '')
|
|
|
+watch([ name, room, url ], ([ _, __, ___ ], [ _o, __o, ___o ]) => {
|
|
|
+ if (_ && __ && ___) emit('update:modelValue', '')
|
|
|
+ if (___ !== ___o) {
|
|
|
+ localStorage.setItem('URL', ___)
|
|
|
+ }
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
@@ -79,7 +82,7 @@ watch([ name, room, url ], () => {
|
|
|
<div>
|
|
|
<button
|
|
|
:disabled="!name && !room && !url && !url.includes('mqtt://')"
|
|
|
- :class="{ resetStyle: name && room && url && url.includes('mqtt://')}"
|
|
|
+ :class="{ resetStyle: name && room && url && url.includes('mqtt://') }"
|
|
|
@click="login"
|
|
|
>
|
|
|
加入
|