Skip to content

Commit

Permalink
feat: 在输入错误时显示正确的格式
Browse files Browse the repository at this point in the history
  • Loading branch information
LSX-s-Software committed Aug 24, 2023
1 parent e673dc1 commit 46ab1f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/z-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:maxlength="maxlength"
:minlength="minlength"
:pattern="pattern"
:title="title"
@input="onChange"
/>
<div class="icon">
Expand Down Expand Up @@ -61,6 +62,10 @@ const props = defineProps({
type: String,
required: false,
},
title: {
type: String,
required: false,
},
customRule: {
type: Function as PropType<(value: string) => string>,
required: false,
Expand Down
2 changes: 2 additions & 0 deletions pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
maxlength="16"
minlength="4"
pattern="[a-zA-Z0-9_\-]+"
title="只能包含英文大小写、数字、_和-"
label="用户名/手机号/学号"
required
placeholder="请输入用户名"
Expand All @@ -21,6 +22,7 @@
maxlength="18"
minlength="6"
pattern="[a-zA-Z0-9_\-]+"
title="只能包含英文大小写、数字、_和-"
type="password"
required
placeholder="请输入密码"
Expand Down
5 changes: 5 additions & 0 deletions pages/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
maxlength="16"
minlength="4"
pattern="[a-zA-Z0-9_\-]+"
title="只能包含英文大小写、数字、_和-"
placeholder="请输入用户名"
:custom-rule="usernameRule"
>
Expand All @@ -25,6 +26,7 @@
maxlength="11"
type="tel"
pattern="1[3-9]\d+"
title="请输入正确的11位手机号"
placeholder="请输入手机号"
>
<template #prefix>
Expand All @@ -39,6 +41,7 @@
type="number"
required
pattern="[0-9]+"
title="请输入正确的6位数字验证码"
placeholder="请输入验证码"
>
<template #prefix>
Expand All @@ -58,6 +61,7 @@
maxlength="18"
minlength="6"
pattern="[a-zA-Z0-9_\-]+"
title="只能包含英文大小写、数字、_和-"
placeholder="请输入密码"
>
<template #prefix>
Expand All @@ -72,6 +76,7 @@
maxlength="18"
minlength="6"
pattern="[a-zA-Z0-9_\-]+"
title="只能包含英文大小写、数字、_和-"
placeholder="请再次输入密码"
:custom-rule="confirmedPasswordRule"
>
Expand Down

0 comments on commit 46ab1f9

Please sign in to comment.