$app/paths
import { let assets: "" | `https://${string}` | `http://${string}` | "/_svelte_kit_assets"An absolute path that matches config.kit.paths.assets.
If a value for config.kit.paths.assets is specified, it will be replaced with '/_svelte_kit_assets' during vite dev or vite preview, since the assets don’t yet live at their eventual URL.
assets, let base: "" | `/${string}`A string that matches config.kit.paths.base.
Example usage: <a href="{base}/your-page">Link</a>
base, function resolveRoute(id: string, params: Record<string, string | undefined>): stringPopulate a route ID with params to resolve a pathname.
resolveRoute } from '$app/paths';资产
绝对路径匹配 config.kit.paths.assets。
[注意] 如果指定了
config.kit.paths.assets的值,则在vite dev或vite preview期间,它将被'/_svelte_kit_assets'替换,因为资产尚未位于其最终 URL。
let assets:
| ''
| `https://${string}`
| `http://${string}`
| '/_svelte_kit_assets';基础
一个匹配config.kit.paths.base的字符串。
示例用法: <a href="{base}/your-page">Link</a>
let base: '' | `/${字符串}`;
解决路由
填充路由 ID 以解析路径名。
import { function resolveRoute(id: string, params: Record<string, string | undefined>): stringPopulate a route ID with params to resolve a pathname.
resolveRoute } from '$app/paths';
function resolveRoute(id: string, params: Record<string, string | undefined>): stringPopulate a route ID with params to resolve a pathname.
resolveRoute(
`/blog/[slug]/[...somethingElse]`,
{
slug: stringslug: 'hello-world',
somethingElse: stringsomethingElse: 'something/else'
}
); // `/blog/hello-world/something/else`function resolveRoute(
id: string,
params: Record<string, string | undefined>
): string;Edit this page on GitHub llms.txt