提交 a728cd2a 编写于 作者: fxy060608's avatar fxy060608

fix(app-plus): compatible with crypto, window.crypto, global.crypto

上级 09e77065
...@@ -25,6 +25,7 @@ const { ...@@ -25,6 +25,7 @@ const {
const runtimePath = '@dcloudio/uni-mp-weixin/dist/mp.js' const runtimePath = '@dcloudio/uni-mp-weixin/dist/mp.js'
const wxsPath = '@dcloudio/uni-mp-weixin/dist/wxs.js' const wxsPath = '@dcloudio/uni-mp-weixin/dist/wxs.js'
const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/index.js') const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/index.js')
const cryptoPath = path.resolve(__dirname, '../crypto.js')
function getProvides (isAppService) { function getProvides (isAppService) {
if (isAppService) { if (isAppService) {
...@@ -37,7 +38,10 @@ function getProvides (isAppService) { ...@@ -37,7 +38,10 @@ function getProvides (isAppService) {
'Behavior': [runtimePath, 'Behavior'], 'Behavior': [runtimePath, 'Behavior'],
'getDate': [wxsPath, 'getDate'], 'getDate': [wxsPath, 'getDate'],
'getRegExp': [wxsPath, 'getRegExp'], 'getRegExp': [wxsPath, 'getRegExp'],
'uniCloud': [uniCloudPath, 'default'] 'uniCloud': [uniCloudPath, 'default'],
'crypto': [cryptoPath, 'default'],
'window.crypto': [cryptoPath, 'default'],
'global.crypto': [cryptoPath, 'default']
} }
} }
return { // app-view return { // app-view
......
...@@ -44,7 +44,11 @@ function getProvides () { ...@@ -44,7 +44,11 @@ function getProvides () {
process.env.UNI_USING_V8 process.env.UNI_USING_V8
) { ) {
provides['__f__'] = [path.resolve(__dirname, 'format-log.js'), 'default'] provides['__f__'] = [path.resolve(__dirname, 'format-log.js'), 'default']
provides['crypto'] = [path.resolve(__dirname, 'crypto.js'), 'default']
const cryptoProvide = [path.resolve(__dirname, 'crypto.js'), 'default']
provides['crypto'] = cryptoProvide
provides['window.crypto'] = cryptoProvide
provides['global.crypto'] = cryptoProvide
} }
// TODO 目前依赖库 megalo 通过判断 wx 对象是否存在来识别平台做不同处理 // TODO 目前依赖库 megalo 通过判断 wx 对象是否存在来识别平台做不同处理
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册