vuex报错: [vuex] Expects string as the type, but found undefined.
报错如图

检查了好久,发现
import * as types from '../mutation-types'
const actions = {
add({commit}){
commit(types.ADD)
}
}
const mutations = {
[types.ADD](state){
state.count++
}
}
这里的 [types.ADD] 如果换成
const actions = {
add({commit}){
commit('ad')
}
}
const mutations = {
ad(state){
state.count++
}
}
就不会报错
判断结果:[types.ADD]这里有问题,
于是 检查mutation-types.js文件

原来是ADD等号右边没有加引号的缘故。导致[types.ADD]的出错
vuex报错: [vuex] Expects string as the type, but found undefined.的更多相关文章
- VUEX报错 [vuex] Do not mutate vuex store state outside mutation handlers
数组 错误的写法:let listData= state.playList; // 数组深拷贝,VUEX就报错 正确的写法:let listDate= state.playList.slice(); ...
- 【spring boot】spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [java.util.Date]
spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [jav ...
- php报错Array to string conversion 解决方案,动态输出数据库列名称
php报错Array to string conversion 解决方案,动态输出数据库列名称 问题:在Windows php5.3环境下使用:<?php echo $row->$keys ...
- MVC模式下unity配置,报错“No connection string named '**Context' could be found in the application config file”
写在前面: 第一次配置时好好的,后来第二次改到MVC模式,把依赖注入写成字典的单例模式时,由于新建的ORM(数据库映射模型EF),怎么弄都不用,一直报错"No connection str ...
- 报错:required string parameter XXX is not present
报错:required string parameter XXX is not present 不同工具发起的get/delete请求,大多数不支持@RequestParam,只支持@PathVari ...
- Vue报错之"[Vue warn]: Invalid prop: type check failed for prop "jingzinum". Expected Number with value NaN, got String with value "fuNum"."
一.报错截图 [Vue warn]: Invalid prop: type check failed for prop "jingzinum". Expected Number w ...
- Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')
Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...
- DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined
DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined 原因:table 中定义的列和aoColumns ...
- 报错org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMapper is not known to the MapperRegistry.
报错org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMa ...
随机推荐
- Java VM
何时需要理解Java 虚拟机机制 一.排错 二.性能优化 字节码文件的执行流程.机制. 涉及到文件的加载机制(类加载器).执行机制(执行引擎).运行时优化(JIT运行时编译).以及内存分配与垃圾回收. ...
- GridView如何将分页数据全部导出为EXCEL?
GRIDVIEW分页状态下将全部数据导出 protected void Button2_Click(object sender, EventArgs e)//按button2将gridview将数据导 ...
- Thinkphp5 runtime路径设置data
路径设置 index.php // runtime文件路径define('RUNTIME_PATH', __DIR__ . '/data/runtime/');
- 【Ubuntu】全局代理
配置代理,Ubuntu下是修改/etc/environment,在后面加入: http_proxy="http://****.com:8080/" https_proxy=&quo ...
- Spring MVC异常处理详解 ExceptionHandler good
@ControllerAdvice(basePackageClasses = AcmeController.class) public class AcmeControllerAdvice exten ...
- 理解IOC
理解IOC 1 IoC理论的背景 我们都知道,在采用面向对象方法设计的软件系统中,它的底层实现都是由N个对象组成的,所有的对象通过彼此的合作,最终实现系统的业务逻辑. 图1:软件系统中耦合的对象 ...
- springboot+swagger2案例
1.pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...
- SQL优化|Java面试题
转载:https://www.cnblogs.com/Jacck/p/8030455.html 数据库的优化问题 一.问题的提出 在应用系统开发初期,由于开发数据库数据比较少,对于查询SQL语句,复杂 ...
- it码农之心灵鸡汤(一)
到底该怎么面对工作,到底怎么面临人生.到底怎么面临青春,对于打工的人来说这些一直都是心中一直无法解惑的谜团. 对于人们怎样看待工作,以前华为创始人任正非说过:非常多人问我,来公司工作有没有双休?需不须 ...
- java序列化/反序列化之xstream、protobuf、protostuff 的比较与使用例子
目录 背景 测试 环境 工具 说明 结果 结论 xstream简单教程 准备 代码 protobuf简单教程 快速入门 下载.exe编译器 编写.proto文件 利用编译器编译.proto文件生成ja ...