From b044605a071011282e898a11c35a7f015225d9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?1024=E5=B0=8F=E7=A5=9E?= <15670339118@163.com> Date: Mon, 16 Dec 2024 10:24:40 +0800 Subject: [PATCH] the app name cannot start with a digit --- src/lang/en_us.ts | 1 + src/lang/ja_jp.ts | 1 + src/lang/ko_kr.ts | 1 + src/lang/zh_cn.ts | 1 + src/lang/zh_tw.ts | 1 + src/pages/edit.vue | 12 ++++++++++++ 6 files changed, 17 insertions(+) diff --git a/src/lang/en_us.ts b/src/lang/en_us.ts index 8b0b9a1c..a1fd5d17 100644 --- a/src/lang/en_us.ts +++ b/src/lang/en_us.ts @@ -31,6 +31,7 @@ export default { urlInvalid: 'The url must start with http', example: 'example', appName: 'AppName', + appNameInvalid: 'The app name cannot start with a digit', appId: 'Identifier', appIdInvalid: 'The appid must be alphanumeric and dot', appIcon: 'AppIcon', diff --git a/src/lang/ja_jp.ts b/src/lang/ja_jp.ts index bfcb1317..deeb72c8 100644 --- a/src/lang/ja_jp.ts +++ b/src/lang/ja_jp.ts @@ -33,6 +33,7 @@ export default { urlInvalid: 'urlはhttpで始まる必要があります', example: '例', appName: 'アプリ名', + appNameInvalid: 'アプリ名は数字で始めることはできません', appId: 'アプリID', appIdInvalid: 'アプリIDは英数字と.で構成されている必要があります', appIcon: 'アプリアイコン', diff --git a/src/lang/ko_kr.ts b/src/lang/ko_kr.ts index 9680d71c..9607b77a 100644 --- a/src/lang/ko_kr.ts +++ b/src/lang/ko_kr.ts @@ -32,6 +32,7 @@ export default { urlInvalid: 'url은 http로 시작해야 합니다', example: '예', appName: '앱 이름', + appNameInvalid: '앱 이름은 숫자로 시작할 수 없습니다', appId: '앱 ID', appIdInvalid: '앱 ID는 영어 숫자와 .로 구성되어야 합니다', appIcon: '앱 아이콘', diff --git a/src/lang/zh_cn.ts b/src/lang/zh_cn.ts index 614712ed..8f2ab9b9 100644 --- a/src/lang/zh_cn.ts +++ b/src/lang/zh_cn.ts @@ -30,6 +30,7 @@ export default { urlInvalid: 'url必须以http开头', example: '例如', appName: 'APP名称', + appNameInvalid: 'app名称不能以数字开头', appId: 'APP标识', appIdInvalid: 'appid必须为字母、数字和.组成', appIcon: 'APP图标', diff --git a/src/lang/zh_tw.ts b/src/lang/zh_tw.ts index 35ce49d2..2ba5ec5d 100644 --- a/src/lang/zh_tw.ts +++ b/src/lang/zh_tw.ts @@ -30,6 +30,7 @@ export default { urlInvalid: 'url必須以http開頭', example: '例如', appName: 'APP名稱', + appNameInvalid: 'APP名稱不能以數字開頭', appId: 'APP標識', appIdInvalid: 'appid必須為字母、數字和.組成', appIcon: 'APP圖標', diff --git a/src/pages/edit.vue b/src/pages/edit.vue index 3390b9aa..b92ecda6 100644 --- a/src/pages/edit.vue +++ b/src/pages/edit.vue @@ -391,6 +391,18 @@ const appRules = reactive({ message: t('inputAppNamePlaceholder'), trigger: 'blur', }, + { + validator: (rule, value, callback) => { + console.log('appshow name value', value) + // the name cannot start with a digit + if (/^[0-9]/.test(value)) { + callback(new Error(t('appNameInvalid'))) + } else { + callback() + } + }, + trigger: 'blur', + }, ], appid: [ {