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

View File

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