Taro: Promise finally 在 iOS (14.2 ,13.4.1) 中报错

Created on 26 Nov 2020  ·  3Comments  ·  Source: NervJS/taro


相关平台

微信小程序

小程序基础库: 2.12.2
使用框架: React

复现步骤

Promise finally 在 iOS (14.2 ,13.4.1) 中报错

期望结果

Promise finally 正常执行

实际结果

undefined is not function

环境信息

  Taro CLI 2.2.15 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.15.1 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD   
      npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD  

F-react T-weapp V-2

Most helpful comment

@hlsky1988 其实直接引入 polyfill 即可:https://github.com/gabmontes/promise-prototype-finally

先执行命令:

npm install promise-prototype-finally

再在项目入口文件开头加上:

import 'promise-prototype-finally';

All 3 comments

查了一下好像是微信的问题 。。。。

附上处理方案 https://www.cnblogs.com/ljybill/p/10097852.html

@hlsky1988 其实直接引入 polyfill 即可:https://github.com/gabmontes/promise-prototype-finally

先执行命令:

npm install promise-prototype-finally

再在项目入口文件开头加上:

import 'promise-prototype-finally';

@hlsky1988 其实直接引入 polyfill 即可:https://github.com/gabmontes/promise-prototype-finally

先执行命令:

npm install promise-prototype-finally

再在项目入口文件开头加上:

import 'promise-prototype-finally';

为什么不用 promise.prototype.finally 呢,我用这个 . 的不行,用 - 的可以。

Was this page helpful?
0 / 5 - 0 ratings