其他分享
首页 > 其他分享> > element-ui form表单添加正则不含有特殊字符

element-ui form表单添加正则不含有特殊字符

作者:互联网

<template>

 <el-form :model="unuseForm" label-position="top" :rules="dialogRules">

 <el-form-item label="原因" prop="loseEfficacyReason">

  <el-input type="textarea" v-model="unuseForm.loseEfficacyReason" auto-complete="off"></el-input>

 </el-form-item>

 </el-form>

</template>

<script>

export default{

 data(){

 return {

  dialogRules: {

  loseEfficacyReason: [

   { required: true, message: '请输入原因', trigger: 'blur' },

   { min: 2, message: '请输入不少于2个字符', trigger: 'blur' },

   { pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+$/, message: '不允许输入空格等特殊符号' }

  ]

  }

 }

 }

}

</script>

标签:unuseForm,form,element,trigger,ui,dialogRules,blur,message,loseEfficacyReason
来源: https://blog.csdn.net/weixin_60131763/article/details/122506747