$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>): string
Populate a route ID with params to resolve a pathname.
resolveRoute } from '$app/paths';
assets
一个匹配 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';
base
一个匹配 config.kit.paths.base
的字符串。
使用示例:<a href="{base}/your-page">链接</a>
let base: '' | `/${string}`;
resolveRoute
使用参数填充路由 ID 以解析路径名。
import { function resolveRoute(id: string, params: Record<string, string | undefined>): string
Populate a route ID with params to resolve a pathname.
resolveRoute } from '$app/paths';
function resolveRoute(id: string, params: Record<string, string | undefined>): string
Populate a route ID with params to resolve a pathname.
resolveRoute(`/blog/[slug]/[...somethingElse]`, {
slug: string
slug: 'hello-world',
somethingElse: string
somethingElse: 'something/else'
}); // `/blog/hello-world/something/else`
function resolveRoute(
id: string,
params: Record<string, string | undefined>
): string;
上一页 下一页