报错如图

检查了好久,发现

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.的更多相关文章

  1. VUEX报错 [vuex] Do not mutate vuex store state outside mutation handlers

    数组 错误的写法:let listData= state.playList; // 数组深拷贝,VUEX就报错 正确的写法:let listDate= state.playList.slice(); ...

  2. 【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 ...

  3. php报错Array to string conversion 解决方案,动态输出数据库列名称

    php报错Array to string conversion 解决方案,动态输出数据库列名称 问题:在Windows php5.3环境下使用:<?php echo $row->$keys ...

  4. MVC模式下unity配置,报错“No connection string named '**Context' could be found in the application config file”

     写在前面: 第一次配置时好好的,后来第二次改到MVC模式,把依赖注入写成字典的单例模式时,由于新建的ORM(数据库映射模型EF),怎么弄都不用,一直报错"No connection str ...

  5. 报错:required string parameter XXX is not present

    报错:required string parameter XXX is not present 不同工具发起的get/delete请求,大多数不支持@RequestParam,只支持@PathVari ...

  6. 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 ...

  7. Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')

    Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...

  8. DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined

    DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined 原因:table 中定义的列和aoColumns ...

  9. 报错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 ...

随机推荐

  1. IMP导入时的错误以及解决办法

    导出命令:exp 用户名/密码@localhost:5050/bkcyunty file=D:\bak\db.dmp log=D:\bak\db.log INDEXES=n STATISTICS=no ...

  2. mysql使用sql语句查询数据库所有表注释已经表字段注释

    场景: 1. 要查询数据库 "mammothcode" 下所有表名以及表注释 /* 查询数据库 ‘mammothcode’ 所有表注释 */ SELECT TABLE_NAME,T ...

  3. [译]Intel App Framework 3.0的变化

    App Framework 3.0 原文 IAN M. (Intel) 发布于 2015-02-11  05:24 我们高兴地宣布App Framework 的新版本3.0发布了.你可以获得最新的代码 ...

  4. 小程序笔记三:幻灯片swiper 和图片自定义高度

    滑动组件:scroll-view wxml代码 <view> <scroll-view scroll-x="true" class="tab-h&quo ...

  5. 你可能不知道UED和UCD

    我们都知道UI是User Interface,即它的本意是用户界面,从字面上看是用户和界面组成,实际上还包括用户与界面之间的交互关系.UI最初对大家来说只是一个名词,它代表一些界面.当然重点还是是UI ...

  6. LR URL编码和解码方法

    问题:URL=http://www.baidu.com/s?wd=%E6%B5%B7%E6%B7%80%E9%BB%84%E5%BA%84"中要对%E6%B5%B7%E6%B7%80%E9% ...

  7. synchronized关键字的用法总结

    synchronized关键字主要有以下这3种用法: 修饰实例方法,作用于当前实例加锁,进入同步代码前要获得当前实例的锁 修饰静态方法,作用于当前类对象加锁,进入同步代码前要获得当前类对象的锁 修饰代 ...

  8. Android开发学习笔记-显示对话框

    private void ShowUpdateDialog() { Log.i("version", "shengji"); AlertDialog.Build ...

  9. 单例模式__new__

    单例模式,使用__new__ __new__是构造函数, __init__是初始化方法,先调用了__new__返回了实例,__init__给这个实例初始化绑定一些属性. class Singleton ...

  10. MS Chart Control 學習手記(二) - 圓餅圖

    using System.Web.UI.DataVisualization.Charting; 02 using System.Drawing; 03   04 namespace Chart.AJA ...