Solution for storing the password when the cursor leaves the WeChat applet password box on iOS

Please add image description
Option 1 : Turn off "Autofill password" on Apple phones, but Apple turns it on by default, and most customers won't turn it off themselves.

Option 2 : Deceive Apple mobile phone and implement the code.

Let’s talk about the solution first. Through testing, we found that when the account box is not empty, the password box is not empty, and neither is empty, and the cursor leaves the account box or password box, the Apple system will automatically prompt to store the password or update the password. tips. After a lot of testing, we found that the account input box refers to the previous input box closest to the password input box, so the solution is to add an account input box above the password input box so that it is always empty and invisible ( The page is invisible and cannot be display:none).

In this way, the previous text box closest to the password box will always be empty, and the iOS storage password prompt will not be triggered.

Insert image description here

code show as below:


<form bindsubmit="formSubmit" class='form'>
	<view class="login-title">员工登录</view>
	<view class="login-input">
		<image src="/image/phone.png"></image>
		<input type="number" placeholder="请输入手机号" placeholder-style=" font-size: 28rpx; " name="no"  value='{
    
    {no}}' maxlength="11"></input>
	</view>
  
    <view  style="width: 1rpx;height: 1rpx;overflow: hidden;">
		<input ></input>
	</view>

	<view class="login-input">
		<image src="/image/password.png"></image>
		<input type="password" name="pwd"  placeholder="请输入密码" value='{
    
    {pwd}}' placeholder-style=" font-size: 28rpx;"></input>
	</view>
	<view class="xieyi">
		<checkbox-group name="xuanxiang1" bindchange="radioChange">
			<!-- <label> -->
				<view>
					<checkbox checked="{
    
    {checked}}">
						<text>阅读并同意该协议,</text>
					</checkbox>
					<text style="color:#D49760;font-size: 29rpx;" bindtap="gologin">《服务协议》</text>
				</view>
			<!-- </label> -->
		</checkbox-group>
	</view>

	<button class="login-btn" type="primary" form-type='submit'>登录</button>
</form>

Guess you like

Origin blog.csdn.net/weixin_40762926/article/details/124857278