Sfoglia il codice sorgente

校验中文名称

lifanagju_citu 6 mesi fa
parent
commit
f4fa223501
1 ha cambiato i file con 11 aggiunte e 1 eliminazioni
  1. 11 1
      src/plugins/necessaryInfo/components/infoForm.vue

+ 11 - 1
src/plugins/necessaryInfo/components/infoForm.vue

@@ -47,7 +47,17 @@ const items = ref({
       default: null,
       label: '姓名 *',
       outlined: true,
-      rules: [v => !!v || '请输入姓名']
+      rules: [
+        value => {
+          if (value) return true
+          return '请输入您的中文名'
+        },
+        value => {
+          var regex = /^[\u4e00-\u9fa5]+$/
+          if (regex.test(value)) return true
+          return '请输入正确的中文名'
+        }
+      ]
     },
     {
       type: 'autocomplete',