modification of global variable “Promise.prototype.finally“ is not allowed when using plugins at app
使用插件后微信小程序报错信息:
[non-writable] modification of global variable “Promise.prototype.finally” is not allowed when using plugins at app.json.
解决,在封装请求的时候判断一下finally
// 无论promise对象最后状态如何都会执行
// Promise.prototype.finally = function(callback) {// let P = this.constructor
// return this.then(
// (value) => P.resolve(callback()).then(() => value),
// (reason) =>
// P.resolve(callback()).then(() => {// throw reason
// })
// )
// }if (!Promise.prototype.finally) {Promise.prototype.finally = function(callback) {let P = this.constructorreturn this.then((value) => P.resolve(callback()).then(() => value),(reason) =>P.resolve(callback()).then(() => {throw reason}))}
}
如果对您有所帮助,给个一键三连吧~~~Thanks♪(・ω・)ノ (✪ω✪) ᕦ(・ㅂ・)ᕤ!!!
modification of global variable “Promise.prototype.finally“ is not allowed when using plugins at app相关推荐
- es6 --- promise.prototype.then的链式引用
很多时候,我们需要使用ajax请求获取数据A.并使用A中的数据A.a来进行下一步的Ajax操作- 下面使用promise.prototype.then的链式引用来实现 // 首先封装一个getJSON ...
- 【ES9(2018)】Promise.prototype.finally()
指定不管最后状态如何都会执行的回调函数. Promise.prototype.finally() 方法返回一个Promise,在promise执行结束时,无论结果是fulfilled或者是reject ...
- es6 Promise.prototype.catch()方法
Promise.prototype.catch()方法 Promise.prototype.catch方法是.then(null, rejection)的别名,用于指定发生错误时的回调函数. getJ ...
- es6 Promise.prototype.then()方法
Promise.prototype.then()方法 Promise 实例具有then方法,也就是说,then方法是定义在原型对象Promise.prototype上的.它的作用是为 Promise ...
- python variable函数_python main函数中变量默认为global variable
在python的main函数中的变量默认为全局变量,而其他的def函数中的变量则默认为局部变量. 当然,局部变量会优先于全局变量,在执行formal_print(t_global)语句时便可看出. 测 ...
- Python全局变量及Global关键字( Global variable in Python)
目录 1. Python全局变量 2. 简单的示例 3. 全局变量的有效作用范围 4. 在函数内部修改变量 5. global关键字 6. 跨模块的情况 1. Python全局变量 Python全局变 ...
- ABAP Access global variable in another program
Created by Wang, Jerry on Nov 14, 2016
- PTC FlexPLM rfa 工作流全局变量赋值 Workflow Global Variable
1.根据当前登录用户和工作流名称定位workitem 2.获取WfAssignedActivity 3.获取activity的ProcessData 4.取变量值或者赋值 5.保存变量新值 代码如下: ...
- EZ430 Chronos 自带程序源码:test 示范程序
2019独角兽企业重金招聘Python工程师标准>>> EZ430 Chronos 自带程序源码:test 示范程序 test.c // ********************** ...
最新文章
- 【OpenCV】内核的形状函数使用记录
- 大白话讲解Promise(二)理解Promise规范
- Python最重要的5大功能,​要是能早点了解就好了
- appium框架之bootstrap
- 在nginx上部署vue项目(history模式);
- URL编码表%20Base64编码表%20HTTP消息含义
- 微服务是否使SOA变得无关紧要?
- JDK1.8中的Stream详解
- C++ 生成洛伦兹的蝴蝶
- 加密机工作原理_三相异步电动机的工作原理
- 大一python题库刷题训练_python实现合工大试题库自动刷题
- 计算机网络系统组播功能_全国计算机等级考试四级计算机网络考试大纲(最新版2018年版)...
- FreeSWITCH核心命令
- 方便好用的论文管理软件EndNote X9 + PDF阅读编辑器Adobe Acrobat DC(1)
- Bootstrap-table固定表头并美化表头
- 用c语言寸件照换底颜色,怎么给证件照换底色【使用步骤】
- 宏晶微MS2109高清视频采集芯片资料
- 上海 政府性 常用网站
- VC环境中获取窗体标题栏的位置和高度
- 系统运维工程师30岁学python_一名Linux系统运维工程师的自述
热门文章
- linux如何调试脚本文件目录,如何在Linux下调试Bash Shell脚本的方法
- java环境变量代表的含义_java 环境变量的涵义
- 计算机网络在我国的发展,04. 当前现状ISP典型架构 计算机网络在我国的发展
- java weblogic多数据源,039 在weblogic下部署jndi的多数据源
- 二维随机变量期望公式_概率论笔记-Ch4期望与方差
- 信息学奥赛一本通(1007:计算(a+b)×c的值)
- ZAP-Queries(洛谷-P3455)
- 怎么判断两颗二叉树相等
- 38 SD配置-销售凭证设置-定义拒绝原因
- 21 MM配置-采购-定义采购组