Create a new page
only create new file in resources/ts/pages
directory and you will have new page with auto generated route.
Create demo page
Create a new file which is demo.vue
in resources/ts/pages
directory with the following content
It will auto register the route with /demo
url in typed-router.d.ts. Navigate to that route and you will find the rendered content of demo.vue
file.
Subpath URL
To create a URL which has something like /dashboards/default
, we need to create dashboards
folder and have to place default.vue
file inside dashboards
folder.
Let's create a new folder named dashboards
in resources/ts/pages
directory. Inside this folder let's create a new file default.vue
with the following content.
then it will generate route with the URL like this:
Dynamic URL✌️
we want to create a page which can accept ids as parameter and we want to fetch data according to that id. This is called dynamic route in terms of vue-router.
Let's we want to create a dynamic route like /customers/<id>
, where id
can be any number.
For this create new folder named customers
in resources/ts/pages
directory and inside customers
create a new file with the name [id].vue
. Place below content inside this create file:
Above code create new Route url which is like this:
With this, if you visit /customers/1
it will render Extra page id : 1
. here, 1 is taken from URL.
If you visit /customers/2
then it will render Extra page id : 2
. It is really very easy to create url using parameter.
Plugins
The following plugins auto-generate routes and wrap layouts in Vue.
Click the links above to view the plugins' official documentation.
Last updated