- 以 D:\SmartSenior 生产工程为源,纳入 AppScope、entry、cjagent、hvigor 及根配置 - 移除 build-profile.json5 的 signingConfigs(p12/p7b/cer 路径与加密口令)及 products.signingConfig 引用 - 不纳入本地与开发产物:local.properties、.idea、.hvigor、.codegenie、demo、backup_a2a_native、SESSION_LOG.md、build_err.txt、build/、oh_modules - .gitignore 追加 .codegenie 与密钥文件通配(*.p12/*.p7b/*.cer/*.jks/*.keystore/*.pem)
27 lines
858 B
TypeScript
27 lines
858 B
TypeScript
// 跳转目标解析:'pages/X?id=1' -> { url: 'pages/X', params: { id: '1' } }
|
|
// router.pushUrl 的 url 不能带 query,参数必须走 params 字段
|
|
export interface RouteTarget {
|
|
url: string;
|
|
params: Record<string, string>;
|
|
}
|
|
|
|
export function parseRouteTarget(target: string): RouteTarget {
|
|
const q = target.indexOf('?');
|
|
if (q < 0) {
|
|
const empty: Record<string, string> = {};
|
|
const plain: RouteTarget = { url: target, params: empty };
|
|
return plain;
|
|
}
|
|
const url = target.substring(0, q);
|
|
const params: Record<string, string> = {};
|
|
const pairs = target.substring(q + 1).split('&');
|
|
for (const p of pairs) {
|
|
const kv = p.split('=');
|
|
if (kv.length === 2 && kv[0].length > 0) {
|
|
params[kv[0]] = decodeURIComponent(kv[1]);
|
|
}
|
|
}
|
|
const result: RouteTarget = { url: url, params: params };
|
|
return result;
|
|
}
|