0
I am creating more than one route in Vue js, however, for any given route is redirected to Login.
js router.
import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import Cadastro from '@/components/Cadastro'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'Login',
component: Login
},
{
path: '/cadastro',
name: 'Cadastro',
component: Cadastro
}
]
})
main.js
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
The registration route, for example, opens Login.
I believe this to be the Routes.js and how is the main.js?
– LeAndrade
I updated with main.js, now.
– Júlio Cesar
Enter the class name of router for Router in the archive
main.js
and in it also Vuerouter and declare it soVue.use(VueRouter);
– LeAndrade