From 993b351a27c26829bf2b704e682d3cf87bd60496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=81=EF=B8=8F=E6=B7=A1=E7=84=B6?= Date: Mon, 18 Aug 2025 13:51:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(uni-cli-shared):=20=E4=BF=AE=E5=A4=8D=20pag?= =?UTF-8?q?es=20=E9=A1=B5=E9=9D=A2=E8=B7=AF=E5=BE=84=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-cli-shared/src/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/uni-cli-shared/src/utils.ts b/packages/uni-cli-shared/src/utils.ts index 9d4a11ce908..0dbbf87f1e9 100644 --- a/packages/uni-cli-shared/src/utils.ts +++ b/packages/uni-cli-shared/src/utils.ts @@ -49,8 +49,9 @@ export function checkElementNodeTag( * @returns */ export function normalizeIdentifier(str: string) { - let _str = str.replace(/[^a-zA-Z0-9]+/g, '-') - _str = capitalize(camelize(_str)) + // pages/my-book/detail -> pages$my_book$detail + // pages-my/book/detail -> pages_my$book$detail + let _str = str.replace(/[\\/]/g, '$').replace(/[^a-zA-Z0-9$]+/g, '_'); // 不允许数字开头,补充 _ if (/^\d/.test(_str)) { _str = '_' + _str