mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
chore: enhance route meta in test + cleanup vue test page
This commit is contained in:
parent
9e88b29bac
commit
7056c9cbc1
6
test/fixtures/basic/nuxt.config.ts
vendored
6
test/fixtures/basic/nuxt.config.ts
vendored
@ -10,6 +10,12 @@ declare module 'nitropack' {
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
globalMiddleware?: string[]
|
||||
}
|
||||
}
|
||||
|
||||
export default defineNuxtConfig({
|
||||
app: {
|
||||
pageTransition: true,
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: [defineNuxtRouteMiddleware((to) => {
|
||||
const globalMiddleware: string[] | undefined = to.meta.globalMiddleware
|
||||
middleware: [(to) => {
|
||||
const globalMiddleware = to.meta.globalMiddleware
|
||||
if (!globalMiddleware?.length) {
|
||||
return createError('Missing to.meta.globalMiddleware')
|
||||
}
|
||||
@ -13,7 +13,7 @@ definePageMeta({
|
||||
if (!globalMiddleware.every((m, idx) => (idx === 0 && m === '01.a.global') || (idx === 1 && m === '01.b.global') || (idx === 2 && m === 'a.global') || (idx === 3 && m === 'b.global'))) {
|
||||
return createError('Missmatch to.meta.globalMiddleware sorting order')
|
||||
}
|
||||
})]
|
||||
}]
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
|
Loading…
Reference in New Issue
Block a user