arshivbastian / vue

a teamwork for vue
0 stars 0 forks source link

add a new route #4

Open arshivbastian opened 5 years ago

arshivbastian commented 5 years ago

Creating rout

for creating new rout in vue.cli project you need to open these two files :

src/router.js
src/App.vue

also you need to create a new file with your favorite name on this directory :
src/views/filename.vue

before starting changes first check you have this lines in src/main.js (or main.ts) 2018-12-16_17-10-28

--> now lets head to src/router.js and add these lines :

{
      path: '/link_address',
      name: 'name',
      component: () => import('./views/a_vue_file_name_in_views')
    }

like picture : 2018-12-16_17-18-42

--> create a file in view directory with exact name that we have mentioned in main.js : 2018-12-16_17-27-36

--> now create a link for our route in App.vue for user to be able to switch between routes : 2018-12-16_17-42-10

now make some changes in your new view : 2018-12-16_17-48-37