posva / unplugin-vue-router

Next Generation file based typed routing for Vue Router
https://uvr.esm.is
MIT License
1.47k stars 67 forks source link

Can we set additional metadata for each routes #384

Closed dante01yoon closed 2 months ago

dante01yoon commented 2 months ago

Hi, I want to get each page route meta data for localization, ie) page a should be default set to "en", page b should be default set to "ko".

can we pass this into VueRouter arrays, and get it from our app codes?

for example

// vite.config.ts 

},
    plugins: [
      VueRouter({
        routesFolder: [
               { src: "src/pages/a", path: "landing/a", locale: "en" }, // <- pass locale meta
               { src: "src/pages/b"", path: "tenants/rfm/shipment/", locale: "ko"},
       ]
    })
  ]
// rotuer.ts
import { routes } from "vue-router/auto-routes";
routes.forEach(route  => ...)