Loginmodal -> script setup

This commit is contained in:
Matthias 2022-12-08 20:22:23 +01:00
parent f2f64fe903
commit 754fabb5b2

View File

@ -7,41 +7,28 @@
title="Login to your bot"
@ok="handleOk"
>
<Login ref="loginForm" in-modal @loginResult="handleLoginResult" />
<login ref="loginForm" in-modal @loginResult="handleLoginResult" />
</b-modal>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
<script setup lang="ts">
import Login from '@/components/Login.vue';
import { ref } from 'vue';
export default defineComponent({
name: 'LoginModal',
components: { Login },
props: {
loginText: { required: false, default: 'Login', type: String },
},
setup() {
const loginViewOpen = ref(false);
const loginForm = ref<HTMLFormElement>();
const handleLoginResult = (result: boolean) => {
if (result) {
loginViewOpen.value = false;
}
};
const handleOk = () => {
loginForm.value?.handleSubmit();
};
return {
loginViewOpen,
loginForm,
handleOk,
handleLoginResult,
};
},
defineProps({
loginText: { required: false, default: 'Login', type: String },
});
const loginViewOpen = ref(false);
const loginForm = ref<HTMLFormElement>();
const handleLoginResult = (result: boolean) => {
if (result) {
loginViewOpen.value = false;
}
};
const handleOk = () => {
loginForm.value?.handleSubmit();
};
</script>
<style scoped></style>