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 ...
随机推荐
- ASP.NET C# 登陆窗体 限制用户名只输入字母 数字以及下划线
文本框的输入限制,我们主要集中两个问题: 一.怎样限制用户名输入的长度? 答:设置txtName的属性 MaxLength="; (我们这里以10个字符为例) 二.怎样限制用户名只输入字母 ...
- what's the help of "unnecessary" pointer comparison
引述自http://c-programming.itags.org/q_c-programming-language_191518.html 源代码中的宏min中使用了 (void) (&_x ...
- vue父组件向子组件动态传值的两种方法
在一些项目需求中需要父组件向子组件动态传值,比如我这里的需求是,父组件动态通过axios获取返回的图片url数组然后传给子组件,上传图片的子组件拿到该数组后进行遍历并展示图片,因为有时候获取到的会是空 ...
- python中如何将字符串连接在一起,多倍的字符串如何输出
说明: 在python中,如果有多个字符串,想要连接在一起,或者说想要拼接在一起该如何操作,在此记录下. 操作过程: 1.通过 + 这个加号操作符,将字符串拼接在一起 >>> &qu ...
- javascript的特殊条件语句
摘要: 由于javascript语言的特殊性导致它有很多特殊的条件判断,下面我列出了一些特殊的条件判断语句和他们对应的结果. if(condition) { console.log(true); ...
- MongoDB中常用的find
接着前一篇文章,下面主要介绍一下MongoDB中常用的find操作. 先打开MongoDB shell,通过下面一组命令插入一些数据. post1 = {} post2 = {} post3 = {} ...
- flexbox子盒子align-self属性
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 产品半夜发现bug让程序员加班,程序员应如何回应?
群友半夜2点被产品叫起来改东西,然后他打车去公司加班,群友愤慨,特为此创作一个小段子 产品:XXX出bug了你赶紧看看 修复一下 开发:我宿舍没电脑 没网络啊 产品:你看看周围有没有网吧远程一下 或者 ...
- office系列调节背景主题
更改背景主题可以参考:https://jingyan.baidu.com/article/ff42efa9332adec19e220200.html 但是这种方法只是改变了整个软件外框架的背景颜色.以 ...
- wee hours
前言: 程序员问科比:“你为什么这么成功? ” 科比:“你知道凌晨四点的城市是什么样子吗?” 程序员:“知道,一般那个时候我还在写代码,怎么了?” 科比:“没事了……” 说起程序员,可能很多人脑中会蹦 ...