美文网首页
邮箱验证必须以什么结尾

邮箱验证必须以什么结尾

作者: 泪滴在琴上 | 来源:发表于2023-07-27 15:33 被阅读0次
<p class="label">邮箱</p>
                <!-- :rules="[{ required: true, message: `请输入${ele.name}` }]" -->
              <p>
                <van-field
                  v-model="staff_number"
                  name="staff_number"
                  placeholder="请输入邮箱"
                  @blur="handleEmailInput"
                /><span style="color:red;margin-top:.16rem;display:block;">*后缀必须是henkel.com</span>
              </p>
    handleEmailInput(event) {
      const inputValue = event.target.value;
      const isValid = this.validateEmail(inputValue);
      if (!isValid) {
        // 处理错误逻辑
        this.staff_number = ''
        this.$toast("邮箱后缀必须是henkel.com", 'error')
        return
      }
    },
    validateEmail(email) {
      const regexPattern = /henkel\.com$/;
      if (!email) {
        return false; // 为空时直接返回false
      }
      return regexPattern.test(email);
    },

相关文章

网友评论

      本文标题:邮箱验证必须以什么结尾

      本文链接:https://www.haomeiwen.com/subject/sjnlpdtx.html