]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: lazy loading example (#1995)
authorKian Salout <info@kiansalout.com>
Mon, 23 Oct 2023 18:42:02 +0000 (20:42 +0200)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2023 18:42:02 +0000 (20:42 +0200)
Co-authored-by: Eduardo San Martin Morote <posva13@gmail.com>
packages/docs/guide/advanced/lazy-loading.md

index e4ac1dab3e502337f0dfc3d5e80a3c2181f75e2e..1909d3d36f94755d07cbe9d3c371509f564a1e68 100644 (file)
@@ -17,7 +17,11 @@ const UserDetails = () => import('./views/UserDetails.vue')
 
 const router = createRouter({
   // ...
-  routes: [{ path: '/users/:id', component: UserDetails }],
+  routes: [
+    { path: '/users/:id', component: UserDetails }
+    // or use it directly in the route definition
+    { path: '/users/:id', component: () => import('./views/UserDetails.vue') },
+  ],
 })
 ```