Remove ID's where not necessary, add type

This commit is contained in:
Matthias 2022-07-10 08:58:15 +02:00
parent 33bfbbd3a5
commit 8ccdb9eb66
2 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<div>
<b-button v-b-modal.modal-prevent-closing>{{ loginText }}</b-button>
<b-modal id="modal-prevent-closing" ref="modalRef" title="Login to your bot" @ok="handleOk">
<Login id="loginForm" ref="loginForm" in-modal @loginResult="handleLoginResult" />
<Login ref="loginForm" in-modal @loginResult="handleLoginResult" />
</b-modal>
</div>
</template>
@ -12,6 +12,10 @@ import { defineComponent, ref } from 'vue';
import Login from '@/components/Login.vue';
interface HTMLModal extends HTMLElement {
hide: () => void;
}
export default defineComponent({
name: 'LoginModal',
components: { Login },
@ -19,11 +23,11 @@ export default defineComponent({
loginText: { required: false, default: 'Login', type: String },
},
setup() {
const modalRef = ref<HTMLElement>();
const modalRef = ref<HTMLModal>();
const loginForm = ref<HTMLFormElement>();
const handleLoginResult = (result: boolean) => {
if (result) {
(modalRef.value as any)?.hide();
modalRef.value?.hide();
}
};
const handleOk = (evt) => {

View File

@ -1,7 +1,7 @@
<template>
<div class="container">
<b-card header="Freqtrade bot Login">
<Login id="loginForm" ref="loginForm" />
<Login ref="loginForm" />
</b-card>
</div>
</template>