Skip to content

Commit ec5e04d

Browse files
committed
fix: mobile prefix style replace
1 parent 7651ec9 commit ec5e04d

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

src/views/user/Register.vue

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<a-form ref="formRegister" :autoFormCreate="(form)=>{this.form = form}" id="formRegister">
55
<a-form-item
66
fieldDecoratorId="email"
7-
:fieldDecoratorOptions="{rules: [{ required: true, type: 'email', message: '请输入邮箱地址' }]}">
7+
:fieldDecoratorOptions="{rules: [{ required: true, type: 'email', message: '请输入邮箱地址' }], validateTrigger: ['change', 'blur']}">
88

99
<a-input size="large" type="text" placeholder="邮箱"></a-input>
1010
</a-form-item>
@@ -22,37 +22,35 @@
2222
<a-form-item
2323
fieldDecoratorId="password"
2424
:fieldDecoratorOptions="{rules: [{ required: true, message: '至少6位密码,区分大小写'}, { validator: this.handlePasswordLevel }
25-
]}">
25+
], validateTrigger: ['change', 'blur']}">
2626
<a-input size="large" type="password" @click="handlePasswordInputClick" autocomplete="false" placeholder="至少6位密码,区分大小写"></a-input>
2727
</a-form-item>
2828
</a-popover>
2929

3030
<a-form-item
3131
fieldDecoratorId="password2"
32-
:fieldDecoratorOptions="{rules: [{ required: true, message: '至少6位密码,区分大小写' }, { validator: this.handlePasswordCheck }]}">
32+
:fieldDecoratorOptions="{rules: [{ required: true, message: '至少6位密码,区分大小写' }, { validator: this.handlePasswordCheck }], validateTrigger: ['change', 'blur']}">
3333

3434
<a-input size="large" type="password" autocomplete="false" placeholder="确认密码"></a-input>
3535
</a-form-item>
3636

3737
<a-form-item
3838
fieldDecoratorId="mobile"
3939
:fieldDecoratorOptions="{rules: [{ required: true, message: '请输入正确的手机号', pattern: /^1[3456789]\d{9}$/ }, { validator: this.handlePhoneCheck } ], validateTrigger: ['change', 'blur'] }">
40-
<!--
41-
<a-input-group size="large" compact>
42-
<a-select style="width: 20%" size="large" defaultValue="+86">
43-
<a-select-option value="+86">+86</a-select-option>
44-
<a-select-option value="+87">+87</a-select-option>
45-
</a-select>
46-
<a-input style="width: 80%" size="large" placeholder="11 位手机号"></a-input>
47-
</a-input-group>
48-
-->
4940
<a-input size="large" placeholder="11 位手机号">
5041
<a-select slot="addonBefore" size="large" defaultValue="+86">
5142
<a-select-option value="+86">+86</a-select-option>
5243
<a-select-option value="+87">+87</a-select-option>
5344
</a-select>
5445
</a-input>
5546
</a-form-item>
47+
<!--<a-input-group size="large" compact>
48+
<a-select style="width: 20%" size="large" defaultValue="+86">
49+
<a-select-option value="+86">+86</a-select-option>
50+
<a-select-option value="+87">+87</a-select-option>
51+
</a-select>
52+
<a-input style="width: 80%" size="large" placeholder="11 位手机号"></a-input>
53+
</a-input-group>-->
5654

5755
<a-row :gutter="16">
5856
<a-col class="gutter-row" :span="16">
@@ -181,16 +179,20 @@
181179
182180
handlePasswordCheck (rule, value, callback) {
183181
let password = this.form.getFieldValue('password')
182+
console.log('value', value)
183+
if (value === undefined) {
184+
callback(new Error('请输入密码'))
185+
}
184186
if (value && password && value.trim() !== password.trim()) {
185187
callback(new Error('两次密码不一致'))
186188
}
187189
callback()
188190
},
189191
190192
handlePhoneCheck (rule, value, callback) {
191-
console.log('rule:', rule)
192-
console.log('value', value)
193-
console.log('callback', callback)
193+
console.log('handlePhoneCheck, rule:', rule)
194+
console.log('handlePhoneCheck, value', value)
195+
console.log('handlePhoneCheck, callback', callback)
194196
195197
callback()
196198
},
@@ -279,6 +281,14 @@
279281
&.success {
280282
color: #52c41a;
281283
}
284+
285+
286+
}
287+
288+
.user-layout-register {
289+
.ant-input-group-addon:first-child {
290+
background-color: #fff;
291+
}
282292
}
283293
</style>
284294
<style lang="scss" scoped>

0 commit comments

Comments
 (0)