Reputation: 11
import Vue from 'vue'
import VueRouter from 'vue-router'
import Posts from './views/Posts'
//Next you need to call Vue.use(Router) to make sure that Router is added as a middleware to our Vue project.
Vue.use(VueRouter)
export default new VueRouter({
//The default mode for Vue Router is hash mode.
//It uses a URL hash to simulate a full URL so that the page won’t be reloaded when the URL changes.
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/',
name: 'posts',
component: Posts,
},
]
})
I am trying above code and run server then it shows this error :
ERROR Failed to compile with 1 error 3:52:40 AM
[eslint] C:\Users\Dell\Downloads\travel-test-main\django_vue\vue2\hello\src\views\Posts.vue 1:1 error Component name "Posts" should always be multi-word vue/multi-word-component-names
Upvotes: 1
Views: 2612
Reputation: 14649
It's always important to understand what an error is trying to tell you.
First, the provided code snippet does not show where the error is. The error says it's in your src\views\Posts.vue
file. I believe you've given us code from your router file.
Second, the error also says that it comes from eslint which is a utility meant to enforce specific coding formatting standards. You're running into an error from an eslint rule called "vue/multi-word-component-names". Simple google search returns the rule documentation. Anyways, to resolve this error you can either follow the rule and give the name of your component a multi-word name, or you can change your eslint config and simply turn the rule off.
.eslintrc
"rules": {
"vue/multi-word-component-names": "off"
}
Upvotes: 2