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 ...
随机推荐
- php 统计fasta 序列长度和GC含量
最近php7的消息铺天盖地, 忍不住想尝试下.星期天看了下语法, 写个小脚本练下手: 这个脚本读取fasta 文件, 输出序列的长度和GC含量: <?php $fasta = "tes ...
- [mysql] linux下使用yum安装mysql
From: http://www.2cto.com/database/201207/141878.html linux下使用yum安装mysql 1.安装 查看有没有安装过: ...
- nginx搭建(centos7)
1.安装前准备: 系统: CentOS 7.5 x64 下载包:wget yum -y install wget 安装: 2.安装一下这些依赖条件: yum install gcc pcre pcre ...
- 地形系统lod
参考其他引擎,地形有近到远进行越来越深的lod,基本完成 下面是u3d的,觉得原理应该是一样的
- unity3d 读取usb摄像头
using UnityEngine; using System.Collections; public class C : MonoBehaviour { private WebCamTexture ...
- PS1-4
export PS2="continue->" cat ps4.sh export PS4='$0.$LINENO+ ' set -x echo "PS4 demo ...
- Node.js静态文件服务器实战[转]
p.s. 在下面这篇文章的指导下,做了一个静态文件服务器,见:https://github.com/walkerwzy/node_static_server ==== 这是一篇阐述得比较详细的文章,从 ...
- ABBYY FineReader 12中的用户模式你会用吗
在ABBYY FineReader 12OCR文字识别软件中,有一个概念叫“训练”,它是在字符图像和字符本身之间建立对应关系的过程,训练模式可以提高含有装饰字体的文档或包含特殊字符(例如数学符号)文档 ...
- 解决PHP中文乱码问题
1.指定链接字符串编码: $mysql_server_name="localhost"; //数据库服务器名称 $mysql_username="root"; ...
- 如何更改webstrom的默认端口63342