From: Eduardo San Martin Morote Date: Wed, 21 Jan 2026 21:57:16 +0000 (+0100) Subject: chore: playground fixes X-Git-Tag: v5.0.0~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74da87c133de8782ef7f2f405ff0e225847f36dd;p=thirdparty%2Fvuejs%2Frouter.git chore: playground fixes --- diff --git a/packages/playground-file-based/src/main.ts b/packages/playground-file-based/src/main.ts index 817377cd5..3801f5da2 100644 --- a/packages/playground-file-based/src/main.ts +++ b/packages/playground-file-based/src/main.ts @@ -11,8 +11,10 @@ const app = createApp(App) app.use(createPinia()) app.use(PiniaColada, {}) -// @ts-expect-error: FIXME: should be doable -app.use(DataLoaderPlugin, { router }) +app.use(DataLoaderPlugin, { + // FIXME: should be doable without `as any` + router: router as any, +}) app.component('RouterLink', RouterLink) app.component('RouterView', RouterView) app.use(router) diff --git a/packages/playground-file-based/src/pages/[...path].vue b/packages/playground-file-based/src/pages/[...path].vue index 282358e0a..71056cbd2 100644 --- a/packages/playground-file-based/src/pages/[...path].vue +++ b/packages/playground-file-based/src/pages/[...path].vue @@ -4,7 +4,13 @@ import doc from '../main.ts?raw' const route = useRoute() const router = useRouter() -route.params.path +// router.push({ +// name: 'not-found', +// params: { +// path: 'yoooo', +// } +// }) +// route.params.optionalWhen console.log('typeof', typeof route.params.active) console.log('value', route.params.active) @@ -28,7 +34,6 @@ definePage({ }, other: { parser: 'bool', - default: false, }, active: { parser: 'bool', @@ -44,6 +49,10 @@ definePage({ default: -1, }, + // optionalWhen: { + // parser: 'date', + // }, + // when: { parser: 'date', default: () => new Date(), diff --git a/packages/playground-file-based/src/params/date.ts b/packages/playground-file-based/src/params/date.ts index eb85e9bdc..76a315a73 100644 --- a/packages/playground-file-based/src/params/date.ts +++ b/packages/playground-file-based/src/params/date.ts @@ -20,11 +20,13 @@ function toString(value: Date): string { } export const parser = defineParamParser({ - get: (value: string | string[] | null) => { + get: value => { if (!value) { throw miss() } - return Array.isArray(value) ? value.map(toDate) : toDate(value) + return Array.isArray(value) + ? value.filter((v): v is string => !!v).map(toDate) + : toDate(value) }, set: (value: Date | Date[]) => Array.isArray(value) ? value.map(toString) : toString(value),