Closed rbaprado closed 9 months ago
Nevermind, just refreshed again and it is working somehow...
BTW it's fine to ask for help but please do it in the Discussions. A bug report requires a boiled down reproduction 🙂
Hello there, I tried yours like this
<route lang="json">
{
"meta": {
"name": "pateta",
"requiresAuth": true
}
}
</route>
Is not working for me.
Instead, it's working for this src/pages/*.vue
<script setup lang="ts">
definePage({
meta: {
requiresAuth: true,
// you can add your custom meta
},
});
</script>
Then in src/router/index.ts
you can do the rest
router.beforeEach((to, from, next) => {
...
console.log(to.meta);
...
if (to.meta.requiresAuth) {
...
};
}
});
But, I also want to validate my method:
Is my method is valid? Using definePage
in <script setup>
?
Starting from a
npm create vuetify
with just the changes highlighted below, I am facing the same problem as #21..\src\pages\index.vue:
frontend_vue\src\router\index.ts:
console.log output:
package.json: