vue3格式校验邮箱和手机号这里写自定义目录标题
<q-input outlined dense :rules="[(val) => val != null || val?.trim() !== '' || '邮箱不能为空',val=>/^[0-9a-zA-Z_.-]+[@][0-9a-zA-Z_.-]+([.][a-zA-Z]+){1,2}$/.test(val)|| '请输入正确的邮箱格式']" v-model="email"maxlength="50" placeholder="邮箱"></q-input>
<q-input outlined dense :rules="[(val) => val != null || val?.trim() !== '' || '手机不能为空',val=>/^[1][3,4,5,7,8,9][0-9]{9}$/.test(val) || '请输入正确的手机格式']"class="q-mt-sm" v-model="phone" maxlength="50"placeholder="手机"></q-input>
我们项目这里是用了quaras样式库哈 不过不影响什么