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 ...
随机推荐
- c#中//注释和///注释的区别 智能注释 显示换行
///会被编译,//不会所以使用///会减慢编译的速度(但不会影响执行速度)///会在其它的人调用你的代码时提供智能感知 也是一种注释,但是这种注释主要有两种作用:1.这些注释能够生成一个XML文件. ...
- 超炫酷的jQuery/HTML5应用效果及源码
jQuery非常强大,我们之前也用jQuery分享过很多实用的插件.HTML5可以让网页变得更加绚丽多彩,将HTML5和jQuery结合使用那将发挥更棒的效果. 今天向大家收集了一些关于HTML5和j ...
- 【CentOS】安装部署jenkins从git获取代码[转]
持续集成①安装部署jenkins从git获取代码 一:持续集成的概念: 1.1:总体的概括 持续集成Continuous Integration 持续交付Continuous Delivery 持续部 ...
- 轻量实用的PHP分页组件:Paginator
来源:https://www.helloweba.com/view-blog-453.html demo:https://www.helloweba.com/demo/2017/Paginator/
- OpenGL 遮挡查询
原文地址:http://www.linuxidc.com/Linux/2015-02/114036.htm 在一个场景中,如果有有些物体被其他物体遮住了不可见.那么我们就不需要绘制它.在复杂的场景中, ...
- hive kettle 学习笔记
学习网址 http://wiki.pentaho.com/display/BAD/Transforming+Data+within+Hive
- ColorSense颜色检测器
下载地址:https://github.com/omz/ColorSense-for-Xcode 修改OMColorSense.xcodeproj工程里的OMColorHelper.m文件的内容,实现 ...
- vue学习起步,vue环境安装
vue安装的前提是安装了nodejs 安装淘宝镜像 npm install -g cnpm --registry=https://registry.npm.taobao.org 安装webpack c ...
- Unity3D编辑器之不实例化Prefab获取删除更新组件
原文链接:http://www.xuanyusong.com/archives/3727
- Windows上使用sqlite3
安装 去官网http://www.sqlite.org/download.html下载Windows下安装包,下载后,解压,设置环境变量 例如放在D:\sqlite3下,将D:\sqlite3加入环境 ...