I'm receiving the error
main.js:8 Uncaught ReferenceError: Cannot access 'router' before initialization at main.js:8
You should. Define the variable first, then use it // main.js :
//1
import Vue from 'cdn.jsdelivr.net/npm/vue@latest/di...'
import { Navbar } from './components/navbar.js'
import { About } from './components/about.js'
import { MainTemplate } from './templates/main-template.js'
//2 Vue.use(VueRouter) const router = new VueRouter({ routes: [{ path: '/about', component: About, name: "About Us Page" }] })
//3 new Vue({ el: '#app', // This should be the same as your
I'm surprised I didn't see your comment. I hope that you were able to fix this error.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm receiving the error
main.js:8 Uncaught ReferenceError: Cannot access 'router' before initialization
at main.js:8
You should. Define the variable first, then use it
// main.js :
//1
import Vue from 'cdn.jsdelivr.net/npm/vue@latest/di...'
import {
Navbar
} from './components/navbar.js'
import {
About
} from './components/about.js'
import {
MainTemplate
} from './templates/main-template.js'
//2
Vue.use(VueRouter)
const router = new VueRouter({
routes: [{
path: '/about',
component: About,
name: "About Us Page"
}]
})
//3
from earlier.new Vue({
el: '#app', // This should be the same as your
components: {
'navbar': Navbar
},
router,
template: MainTemplate
})
I'm surprised I didn't see your comment. I hope that you were able to fix this error.