浏览代码

fix: wifi密码不可必填

lkd9698906@163.com 1 年之前
父节点
当前提交
ad75696b4f
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/pages/mine/wifi/Index.vue

+ 2 - 2
src/pages/mine/wifi/Index.vue

@@ -102,7 +102,7 @@
               name="password"
               label="密码"
               placeholder="请填写WIFI密码"
-              :rules="[{ required: true, message: '请正确填写WIFI密码' }, { validator, message: 'WIFI密码不得于8位' }]"
+              :rules="[{ validator, message: 'WIFI密码不得于8位' }]"
             />
           </van-cell>
         </van-cell-group>
@@ -133,7 +133,7 @@ const wifiTitle = ref<string>(""); // wifi信息弹框标头
 const formData = ref({} as any); // 表单信息
 const wifiInfo = ref({} as any); // WIFI信息
 const wifiDatas = ref<Array<any>>([]); // WIFI信息列表
-const validator = (val: string | any[]) => val.length < 8 ? false : true;
+const validator = (val: string | any[]) => val && val.length < 8 ? false : true;
 // 提交WIFI信息
 function onSubmit() {
   console.log("提交WIFI信息....");