正则表达式

   //颜色失焦验证
      colorBlur() {
        if (!(/^[a-zA-Z\u4e00-\u9fa5]+$/).test(this.color)) {
          this.$Message.warning('只能输入汉字和英文字母!')
          this.color = ''
        }

      },
      //颜色编码失焦验证
      shorthandBlur() {
        if (!(/^[A-Z]+$/).test(this.shorthand)) {
          this.$Message.warning('只能输入大写英文字母!')
          this.shorthand = ''
        }

      },
posted @ 2020-01-14 17:11  苏小白啊  阅读(99)  评论(0编辑  收藏  举报