使用axios 报 name.toUpperCase is not a function
使用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的更多相关文章
- 编译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 ...
- 关于IONIC 报错 XX is not a function
刚开始 做一个项目,总是报错"XX is not a function" 最后发现 原因 , 原来是 服务的 注入位置 有问题. angular.module(" ...
- 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 ...
- 使用CI遇到的问题报错:Call to undefined function base_url()
问题来源:在HTML文件中使用base_url()函数引入CSS文件时,发现报错:Call to undefined function base_url() 研究了一下才知道是因为没有加载url小助手 ...
- 用element-ui 时,报value.getTime is not a function错误:
在用element-ui 时,报value.getTime is not a function错误:错误分析:date-picker 的时间是格林威时间,如果Thu Jun 22 2017 19:07 ...
- jquery 报错 $.cookie is not a function()
jquery 报错 $.cookie is not a function() ——我是之前可以运行的项目,突然报这个错误,很奇怪. 这是jquery的cookie插件报错. 插件名: jquery.c ...
- 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 - ...
- vue3.0使用axios报错问题记录
vue-cli3.0使用axios的时候出现错误,记录一下 报错信息: Uncaught TypeError: Cannot set property $axios of #<Vue> w ...
- axios报错: Cannot read property 'protocol' of undefined ....
错误: Uncaught (in promise) TypeError: **Cannot read property 'protocol' of undefined ... 源码: 完整错误: im ...
随机推荐
- spring boot web服务
[root@d java]# tree -I target .├── pom.xml└── src ├── main │ ├── java │ │ └── com │ │ └── ...
- Git 进阶之底层相关
Git is a content-addressable filesystem. 1. Plumbing 和 Porcelain "Plumbing commands": Git ...
- formset批量处理form表单数据
Formset(表单集)是多个表单的集合.Formset在Web开发中应用很普遍,它可以让用户在同一个页面上提交多张表单,一键添加多个数据 class StudentStudyRecordModel( ...
- macOS Sierra 10.12版本 显示隐藏文件
1.显示隐藏文件 打开Terminal 输入:defaults write com.apple.finder AppleShowAllFiles -bool true 再输入: killall Fin ...
- Python 读取写入配置文件 —— ConfigParser
Python 读取写入配置文件 —— ConfigParser Python 读取写入配置文件很方便,可使用内置的 configparser 模块:可查看源码,如博主本机地址: “C:/python2 ...
- 用nginx的反向代理机制解决前端跨域问题在nginx上部署web静态页面
用nginx的反向代理机制解决前端跨域问题在nginx上部署web静态页面 1.什么是跨域以及产生原因 跨域是指a页面想获取b页面资源,如果a.b页面的协议.域名.端口.子域名不同,或是a页面为ip地 ...
- 百度天气接口api
百度天气接口 以GET形式提交,返回JSON或XML URL:http://api.map.baidu.com/telematics/v3/weather?location={城市名}&out ...
- linux系统进入单用户模式
进入单用户模式可进行root账户和其他普通账户的密码的修改 1)Ubuntu 开机到grub时(在开机时长按shift键),用上下键移到第二行的恢复模式(recovery mode),按e(注意不是回 ...
- VS2010/MFC编程入门之二十八(常用控件:列表视图控件List Control 上)
前面一节中,鸡啄米讲了图片控件Picture Control,本节为大家详解列表视图控件List Control的使用. 列表视图控件简介 列表视图控件List Control同样比较常见, ...
- DB开发之postgresql
1.环境变量配置: PGLIB=/usr/local/pgsql/lib PGDATA=$HOME/data PATH=$PATH:/usr/local/pgsql/bin MANPATH=$MANP ...