fix: email should not required and fix error on empty

This commit is contained in:
Methapon Metanipat 2024-09-05 16:35:51 +07:00
parent 6ec60cc95a
commit 51afed5578
3 changed files with 30 additions and 18 deletions

View file

@ -31,12 +31,16 @@ 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'),
]"
:rules="
readonly
? undefined
: [
(v: string) =>
!v ||
/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(v) ||
$t('form.error.invalid'),
]
"
v-model="mail"
/>
<q-input