zhaoxiaohai 3 年之前
父節點
當前提交
854395bb1b
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 3 1
      pages/login/phone.js
  2. 4 2
      pages/login/phone.wxml

+ 3 - 1
pages/login/phone.js

@@ -12,6 +12,7 @@ Page({
         accountno: "",
         password: "",
         inputType: "password", //密码输入框类型
+        focus: false,
         memory: true, //记忆
         disabled: true, //是否禁用
         loading: false, //登陆中
@@ -85,7 +86,8 @@ Page({
     /* 改变密码输入框类型 */
     changePasswordType() {
         this.setData({
-            inputType: this.data.inputType == "text" ? 'password' : 'text'
+            inputType: this.data.inputType == "text" ? 'password' : 'text',
+            focus: true
         })
     },
     /* 授权 */

+ 4 - 2
pages/login/phone.wxml

@@ -5,8 +5,10 @@
 </van-cell>
 <van-cell>
     <text slot='icon' class="iconfont icon-a-wodemima" />
-    <input class="input" type="{{inputType}}" bindinput="inputPassword" value="{{password}}" placeholder="请输入密码" />
-    <image slot='right-icon' bindtap="changePasswordType" class="image" src="{{inputType=='password'?'/static/image/dp-show.svg':'/static/image/dp-none.svg'}}" />
+    <input class="input" type="{{inputType}}" focus='{{focus}}' bindinput="inputPassword" value="{{password}}" placeholder="请输入密码" />
+    <view slot='right-icon' style="width: 90rpx;height: 22.4px; display: flex; justify-content: flex-end;" catchtap="changePasswordType">
+        <image class="image" src="{{inputType=='password'?'/static/image/dp-none.svg':'/static/image/dp-show.svg'}}" />
+    </view>
 </van-cell>
 
 <view class="box">