<FormItem label="密码" prop="adminPwd" :rules="[{required: true , trigger: 'change',message: '请填写密码!'},
{min:6,max:16,trigger: 'change',message: '密码输入长度6位到16位之间!'},
{ validator (rule, value, callback, source, options) {
const errors = []
var reg = /^[A-Za-z0-9]+$/;
if (!reg.test(value) && adminPwd)
{ errors.push('请输入英文或者数字组合') }
callback(errors) }},
]">
<Input
:maxlength="18"
v-model="adminPwd"
placeholder="请输入6-18位密码"
:type="seen ?'text':'password'"
>
<Icon
:type="seen ?'ios-eye-outline':'ios-eye-off-outline'"
size="26"
slot="suffix"
@click="changeIcon"
/>
</Input>
</FormItem>
seen: true, //默认密码是可见
// 控制密码是否可见
changeIcon() {
this.seen = !this.seen;
},
默认是text,所以不填充,展示如下: