在vue中使用setTimeout(function,delay) 和 setInterval(function,delay)
发表于:2023-01-12 15:54:21浏览:355次
注意事项:methods里面的方法必须放置方法里面,并且必须在外部定义this
//methods里面的方法必须放置方法里面,并且必须在外部定义this
let _this = this
_this.eventInterval = setInterval(function () {
_this.functionName()
},1000)
_this.eventTimeout = setTimeout(function () {
_this.functionName()
},1000)
//在离开页面的时候关闭
destroyed(){
let _this = this;
clearInterval(_this.eventInterval)
clearTimeout(_this.eventTimeout)
}
栏目分类全部>
推荐文章
- mysql报错:SQLSTATE[HY000]: General error: 1881 Operation not allowed when innodb_forced_recovery > 0.
- 关于微信公众号认证问题
- CssToInlineStyles 将 HTML 转换为内联样式的类
- Mysql报错:SQLSTATE[HY000] [1045] Access denied for user '数据库名'@'localhos
- TVBox影视仓源
- 一键下载网站所有资源
- fastadmin表单动态下拉SelectPage示例
- fastadmin表单radio示例
- fastadmin列表通用搜索如何加入城市选择器
- php导出数据xlsx
