Uncaught (in promise) TypeError:的错误
1、错误
创建一个vue实例,在data定义一些变量,如activityTime。
在methods里面用了axios发送请求。
在then的回调里使用this.activityTime
报错!
2、原因。then没有跟promise实例同步执行就会出现上述的错误。
axios的then(function(){
console.dir(this) //this->undefined
})
3、解决
可以用bind绑定this的指向当前vue的实例
axios的then(function(){
console.dir(this) //this->undefined
}.bind(this))
Uncaught (in promise) TypeError:的错误的更多相关文章
- [Angular] ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'name' of undefined
在数据请求完成通过 ionViewDidLoad 展示页面的时候 报错误 : ERROR Error: Uncaught (in promise): TypeError: Cannot read pr ...
- Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')
Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...
- tinymce 出现 Uncaught (in promise) TypeError: ae(...).createObjectURL is not a function
需要引入两个JS文件:jQuery.tinymce.min.js 和 tinymce.min.js <script type="text/javascript" src=&q ...
- 关于 promise 吃到错误的理解
关于 promise 吃到错误的理解 下面的内容需要对浏览器原生支持的 promise 的基本用法有了解,如果你还不知道 promise 和 promise 的 catch 方法,你可能需要先在 这里 ...
- Atitit Uncaught (in promise) SyntaxError Unexpected token < in JSON at position 0
Atitit Uncaught (in promise) SyntaxError Unexpected token < in JSON at position 0 Uncaught (in ...
- axios请求报Uncaught (in promise) Error: Request failed with status code 404
使用axios处理请求时,出现的问题解决 当url是远程接口链接时,会报404的错误: Uncaught (in promise) Error: Request failed with status ...
- Uncaught (in promise)
Uncaught (in promise) 使用es6的promise时候,有时候会出现如下错误: 这是因为,使用定义promise方法的时候,reject了,但是,在使用的地方没有用catch进行接 ...
- vue报错vue-router.esm.js?8c4f:2007 Uncaught (in promise) NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated"}
今天在写vue项目配置好路由点击菜单时,突然在控制台报错. 错误信息如下: Uncaught (in promise) NavigationDuplicated {_name: "Navig ...
- 解决"Uncaught (in promise) Error: Navigation cancelled from "/" to "/login" with a new navigation"报错处理
Uncaught (in promise) Error: Navigation cancelled from "/" to "/login" with a ne ...
随机推荐
- J2ee入门:servlet-mapping的映射配置
<servlet-mapping>元素在Servlet和URL样式之间定义一个映射.它包含了两个子元素<servlet- name>和<url-pattern> & ...
- python-3.x-基本数据类型
当前学习版本为: python-3.6-4 代码: """整型 NUMBER""" a = 2 ** 5 b = a + 4 c = a / ...
- RxJava系列1(简介)
RxJava系列1(简介) RxJava系列2(基本概念及使用介绍) RxJava系列3(转换操作符) RxJava系列4(过滤操作符) RxJava系列5(组合操作符) RxJava系列6(从微观角 ...
- python网络编程基础(一)
一.C/S架构 客户端/服务端架构 二.OSI七层架构 七层模型,亦称OSI(Open System Interconnection)参考模型,是参考模型是国际标准化组织(ISO)制定的一个用于计算机 ...
- Hive:动静态分区
http://hugh-wangp.iteye.com/blog/1612268 http://blog.csdn.net/opensure/article/details/46537969 使用静态 ...
- scrapy爬取豆瓣电影top250
# -*- coding: utf-8 -*- # scrapy爬取豆瓣电影top250 import scrapy from douban.items import DoubanItem class ...
- Entry的验证
Entry组件是支持验证输入的合法性的, 比如要求输入数字,你输入了字母就是非法. 实现该功能,需要通过设置validate,validatecommand,invalidcommand选项. 1.首 ...
- JSONObject和JSONArray区别及基本用法
一.JSONObject和JSONArray的数据表示形式 JSONObject的数据是用 { } 来表示的, 例如: { "id" : "123", & ...
- spring clound微服务架构实践(1)——搭建服务注册中心
一.创建一个空maven parent模板 1-1.新建project,选择maven 1-2.给此模板起名 1-3.此模板的保存位置,此处放入我的git项目spring-clound-learnin ...
- MongoDB系列六(聚合).
一.概念 使用聚合框架可以对集合中的文档进行变换和组合.基本上,可以用多个构件创建一个管道(pipeline),用于对一连串的文档进行处理.这些构件包括筛选(filtering).投射(project ...