feat: validate email
This commit is contained in:
parent
d6e8d754ab
commit
9466019303
3 changed files with 18 additions and 0 deletions
|
|
@ -38,6 +38,12 @@ defineProps<{
|
|||
hide-bottom-space
|
||||
class="col-12 col-md-4"
|
||||
:label="$t('form.email')"
|
||||
:rules="[
|
||||
(v: string) => !!v || $t('form.error.required'),
|
||||
(v: string) =>
|
||||
/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(v) ||
|
||||
$t('form.error.invalid'),
|
||||
]"
|
||||
for="input-email"
|
||||
:model-value="readonly ? email || '-' : email"
|
||||
@update:model-value="(v) => (typeof v === 'string' ? (email = v) : '')"
|
||||
|
|
|
|||
|
|
@ -268,6 +268,12 @@ watch(
|
|||
outlined
|
||||
:readonly="readonly"
|
||||
:label="$t('form.email')"
|
||||
:rules="[
|
||||
(v: string) => !!v || $t('form.error.required'),
|
||||
(v: string) =>
|
||||
/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(v) ||
|
||||
$t('form.error.invalid'),
|
||||
]"
|
||||
class="col-md-3 col-6"
|
||||
:model-value="readonly ? email || '-' : email"
|
||||
@update:model-value="(v) => (typeof v === 'string' ? (email = v) : '')"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@ const telephone = defineModel<string>('telephone');
|
|||
hide-bottom-space
|
||||
class="col-md-6 col-12"
|
||||
:label="$t('form.email')"
|
||||
:rules="[
|
||||
(v: string) => !!v || $t('form.error.required'),
|
||||
(v: string) =>
|
||||
/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(v) ||
|
||||
$t('form.error.invalid'),
|
||||
]"
|
||||
v-model="mail"
|
||||
/>
|
||||
<q-input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue