2023.10.26笔记

 {
            validator: (rule, value, callback) => {
              const strongRegex = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]/;
              const mediumRegex = /^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/;
              if (strongRegex.test(value)) {
                callback();
              } else if (mediumRegex.test(value)) {
                callback(new Error("密码强度不够,请包含大、小写字母、特殊符号和数字中的至少3种类型"));
              } else {
                callback(new Error("密码长度至少8位,包含大、小写字母、特殊符号和数字中的至少3种类型"));
              }
            },

            trigger: "blur",
          },

大小写,特殊符号,数字起码包含3种,正则rule验证.

   var introduce = introduceData.paymentPlan.find(function (introduce) {
                        return introduce.name === '标准';
                    });
                    if (introduce) {
                        var type = introduce.type;
                    }

根据参数筛选,不走数组

你可能感兴趣的:(笔记,前端,javascript)