使用axios 报 name.toUpperCase is not a function

可能是许久没有用vue了,有些生疏,加上尝试之前总结的思路,这次在项目上实现时,碰到的问题。让人有些懵,不知所措,还是需要项目来稳住我这漂浮的心

先抛出错误

name.toUpperCase is not a function一般不外乎语法错误,或者没有这个值,结果我debugger 等,都没能有效的找到原因所在,只能大量搜索,终于碰到一个可能跟我类似的问题

鄙人代码片段

axios.defaults.headers = `'Content-Type': 'application/json', 'Accept': 'application/json'`

我也不知道为何 我会写成这个,结果就出现上诉的错误,而自己一下子也没察觉出来,最后才发现怎么是字符串。修改如何

axios.defaults.headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}

字符串改为 对象就好了

总结

  • 问题解决简单,但是找到原因所在,确是百般困难,并不是一下子就出来了,总以为自己写的没错,不应该是小问题错误,想想就无言
  • 所以鄙人一再告诫自己多看问题,先看看是不是配置等有问题,再去检索,如此更好

使用axios 报 name.toUpperCase is not a function的更多相关文章

  1. 编译PHP 报错:node.c: In function dom_canonicalization

    编译PHP 报错:node.c: In function dom_canonicalization  /opt/php-5.2.17/ext/dom/node.c:1953: error: deref ...

  2. 关于IONIC 报错 XX is not a function

    刚开始 做一个项目,总是报错"XX is not  a function"   最后发现 原因 ,   原来是 服务的 注入位置 有问题. angular.module(" ...

  3. JS function document.onclick(){}报错Syntax error on token "function", delete this token

    JS function document.onclick(){}报错Syntax error on token "function", delete this token func ...

  4. 使用CI遇到的问题报错:Call to undefined function base_url()

    问题来源:在HTML文件中使用base_url()函数引入CSS文件时,发现报错:Call to undefined function base_url() 研究了一下才知道是因为没有加载url小助手 ...

  5. 用element-ui 时,报value.getTime is not a function错误:

    在用element-ui 时,报value.getTime is not a function错误:错误分析:date-picker 的时间是格林威时间,如果Thu Jun 22 2017 19:07 ...

  6. jquery 报错 $.cookie is not a function()

    jquery 报错 $.cookie is not a function() ——我是之前可以运行的项目,突然报这个错误,很奇怪. 这是jquery的cookie插件报错. 插件名: jquery.c ...

  7. JS function document.onclick(){}报错Syntax error on token "function", delete this token - CSDN博客

    原文:JS function document.onclick(){}报错Syntax error on token "function", delete this token - ...

  8. vue3.0使用axios报错问题记录

    vue-cli3.0使用axios的时候出现错误,记录一下 报错信息: Uncaught TypeError: Cannot set property $axios of #<Vue> w ...

  9. axios报错: Cannot read property 'protocol' of undefined ....

    错误: Uncaught (in promise) TypeError: **Cannot read property 'protocol' of undefined ... 源码: 完整错误: im ...

随机推荐

  1. Token Based Authentication -- Implementation Demonstration

    https://www.w3.org/2001/sw/Europe/events/foaf-galway/papers/fp/token_based_authentication/

  2. DNS named. bind linux (ACL/View)---dnsmasq-with docker,hosts in docker.

    [bind--named.conf] https://blog.csdn.net/z_yttt/article/details/53020814 [Docker搭建dnsmasq] https://b ...

  3. php版本管理工具composer安装及使用

    类似于web前端有gulp,webpack,grunt.php也有专门的包安装管理和安装工具,即composer. composer官网:https://getcomposer.org      中文 ...

  4. MongoDB Windows环境安装及配置( 一)

    原文http://www.cnblogs.com/lzrabbit/p/3682510.html MongoDB一般安装 1.首先到官网 (http://www.mongodb.org/downloa ...

  5. mysql 数据操作 单表查询 where约束 between and or

    WHERE约束 where字句中可以使用: 比较运算符:>< >=  <=  != between 80 and 100 值在80到100之间   >=80  <= ...

  6. git-【四】撤销修改和删除文件操作

    一:撤销修改: 比如我现在在readme.txt文件里面增加一行 内容为555555555555,我们先通过命令查看如下: 在未提交之前,发现添加5555555555555内容有误,所以得马上恢复以前 ...

  7. python 实现的比特币代码 及 加密货币学习线路图及书籍资料

    http://www.pycoind.org/ https://github.com/samrushing/caesure https://bitcointalk.org/index.php?topi ...

  8. spring Security 得到认证用户名的方法

    @Service("userService")public class UserServiceImpl implements UserService { @Overridepubl ...

  9. Hyperledger Fabric 开发环境搭建 centos7系统

    一.安装GO语言 下载最新版的go 打开Terminal,输入命令(以下命令都是以root管理员的角色进行的) su 输入密码:***** wget https://storage.googleapi ...

  10. 凌华AMP-204C卡的CNC功能 即Feeder工具的使用。

    Feeder  可以实现一些CNC之类的功能. 不过目前似乎只有两个轴的联动