el-form正则校验区分中英文字符长度
rule中写 { validator: validateChinese, trigger: 'blur' }
const validateChinese = (rule, value, callback) => {
const regex = /[\u4e00-\u9fa5]+/g
const chineseArr = value.match(regex)
const chinese = chineseArr ? chineseArr.join('') : ''
const elseSymbol = value.replace(regex, '')
const length = chinese.length * 2 + elseSymbol.length
if (length < 4 || length > 100) {
callback('文件名称4-100个字符之间')
} else {
callback()
}
}