ERROR Failed to compile with 1 error

 WARNING  Compiled with 1 warning                                                                                                                      23:24:43
 warning  in ./src/main.js

export 'default' (imported as 'store') was not found in './store' (module has no exports)
This error occurred because the relevant export store was not found.

Just add export default store  in src/stoer/index.js 

import { createStore } from "vuex"


//vuex 的核心作用就是帮我们管理组件之间的状态的
const store = createStore({
    //所有的状态数据都放在这里(数据)
    state:{
        counter:0
    }
})

export default store

2. If you want to solve the problem in the picture above, in the .eslintrc.js file, add the code in the red box to solve the problem of the code becoming popular. The complete error message: Parsing error: No Babel config file detected for D:\VuecliWorkspace \vue_test\src\main.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

It is written to use requireConfigFile:false to solve the problem

Solution: "requireConfigFile":false

 

3. What to do if the error Component name "xxxx" should always be multi-word vue/multi-word-comp appears in the Vue project? Just add this line of code. 1. Preface It may be reported when we write the Vue project Such a mistake: it is recommended to modify the text

Find the vue.config.js file in our project and configure the file. The configuration information is as follows:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false
})

Generally, if you have the vue.config.js file, you only need to add the following line of code.

lintOnSave:false

4. Remove this in this code const handleLogin=()=>{

      this.$store.commit("setCoun",100);

      console.log(store.state.count);

    }

 

 

5,

 

 

Guess you like

Origin blog.csdn.net/lv_suri/article/details/126219408