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)
出现这种报错是因为没有找相关导出store

在src/stoer/index.js中加入导出 export default store 即可

import { createStore } from "vuex"


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

export default store

2.想要解决上图的问题,在.eslintrc.js文件中,添加红色框中的代码,就可以解决代码爆红的问题完整报错信息: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

里面写了使用requireConfigFile:false解决

解决方法: "requireConfigFile":false

 

3,Vue项目中出现error Component name "xxxx" should always be multi-word vue/multi-word-comp报错信息怎么办,直接添加这行代码就行 一、前言 在我们写Vue项目的时候可能会报出这样一个错误:建议修改文

在我们的项目中找到vue.config.js文件,配置改文件,配置信息如下:

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

一般有vue.config.js这个文件的只需要添加下面的一行代码就行

lintOnSave:false

4.将这段代码中的this去掉 const handleLogin=()=>{

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

      console.log(store.state.count);

    }

 

 

5,

 

 

  • 3
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值