Explorar el Código

限制最大昵称输入数

wangcy hace 4 meses
padre
commit
fb87d9a4ed
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      features/user/src/main/ets/pages/SettingPage.ets

+ 6 - 0
features/user/src/main/ets/pages/SettingPage.ets

@@ -184,6 +184,12 @@ struct SettingPage {
         .backgroundColor(Color.White)
         .border({ width: 1, color: '#14000000' })
         .margin({ bottom: 25 })
+        .onChange((value) => {
+          if (value.length > 7) {
+            this.value = value.slice(0, 7)
+            IBestToast.show({ type: "warning", message: '用户名称最大为7位' })
+          }
+        })
 
       Row({ space: 32 }) {
         YtButton({