mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-12 15:27:13 +00:00
c906312034
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Roe <daniel@roe.dev>
37 lines
801 B
Vue
37 lines
801 B
Vue
<script setup lang="ts">
|
|
definePageMeta({
|
|
name: 'some-custom-name',
|
|
path: '/some-custom-path',
|
|
validate: () => true,
|
|
middleware: [() => true],
|
|
otherValue: {
|
|
foo: 'bar',
|
|
},
|
|
})
|
|
|
|
const serialisedMeta: Record<string, string> = {}
|
|
const meta = useRoute().meta
|
|
for (const key in meta) {
|
|
if (Array.isArray(meta[key])) {
|
|
serialisedMeta[key] = meta[key].map((fn: () => unknown) => fn.toString())
|
|
continue
|
|
}
|
|
if (typeof meta[key] === 'string') {
|
|
serialisedMeta[key] = meta[key]
|
|
continue
|
|
}
|
|
if (typeof meta[key] === 'object') {
|
|
serialisedMeta[key] = JSON.stringify(meta[key])
|
|
continue
|
|
}
|
|
if (typeof meta[key] === 'function') {
|
|
serialisedMeta[key] = meta[key].toString()
|
|
continue
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<pre>{{ serialisedMeta }}</pre>
|
|
</template>
|