4.0.0
This is an updateincluding breaking changes forsome environments.
In this version Math.random() has been replaced by the random methods of the native crypto module.
For this reason CryptoJS might not run insome JavaScript environments withoutnative crypto module. Such as IE 10orbeforeor React Native.
你用的版本是4.0.0吧。
假设使用这个版本的话,这个版本有些大变动,以下摘自https://github.com/brix/crypto-js
4.0.0 This is an update including breaking changes for some environments. In this version Math.random() has been replaced by the random methods of the native crypto module. For this reason CryptoJS might not run in some JavaScript environments without native crypto module. Such as IE 10 or before or React Native.
根据描述,变动是需要native crypto module,我猜测这个模块是来自浏览器,而小程序环境没有这个模块,所以有个方法就是降级使用crypto-js,如3.3.0
参考自https://developers.weixin.qq.com/community/develop/doc/000c2679ae0ad0fc25ba7a72656c00?_at=1592410733853
一直用的就是它。