16.08 Login - Reuse the Register Component

This commit is contained in:
Fredrick W. Warren 2021-02-12 15:30:28 -08:00
parent 47f441a3d8
commit 2ddb3c44bd
2 changed files with 20 additions and 6 deletions

View File

@ -5,7 +5,7 @@
<template v-slot:avatar> <template v-slot:avatar>
<q-icon name="account_circle" color="primary" /> <q-icon name="account_circle" color="primary" />
</template> </template>
Register to access your Todos anywhere {{ title }}
</q-banner> </q-banner>
</div> </div>
<div class="row q-mb-md"> <div class="row q-mb-md">
@ -46,6 +46,10 @@
<script> <script>
export default { export default {
props: [
'tab',
'title'
],
data () { data () {
return { return {
formData: { formData: {
@ -65,7 +69,11 @@ export default {
this.$refs.email.validate() this.$refs.email.validate()
this.$refs.password.validate() this.$refs.password.validate()
if (!this.$refs.email.hasError && !this.$refs.password.hasError) { if (!this.$refs.email.hasError && !this.$refs.password.hasError) {
console.log('Bang Bang') if (this.tab === 'login') {
console.log('login')
} else {
console.log('register')
}
} }
} }
} }

View File

@ -19,11 +19,17 @@
<q-tab-panels v-model="tab" animated> <q-tab-panels v-model="tab" animated>
<q-tab-panel name="login"> <q-tab-panel name="login">
<div class="text-h6">Login</div> <div class="text-h6">Login</div>
Lorem ipsum dolor sit amet consectetur adipisicing elit. <login-register
:tab="tab"
title="Please enter your email and passoword"
/>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="register"> <q-tab-panel name="register">
<register /> <login-register
:tab="tab"
title="Register to access your Todos anywhere"
/>
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
</q-card> </q-card>
@ -31,7 +37,7 @@
</template> </template>
<script> <script>
import register from 'components/Auth/Register.vue' import loginRegister from 'components/Auth/LoginRegister.vue'
export default { export default {
name: 'Auth', name: 'Auth',
@ -41,7 +47,7 @@ export default {
} }
}, },
components: { components: {
register loginRegister
} }
} }
</script> </script>