Skip to content

Commit 131a177

Browse files
committed
fix: #87
1 parent b423430 commit 131a177

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42317,7 +42317,8 @@ module.exports = function() {
4231742317
})
4231842318

4231942319
// 注入 api
42320-
global.wx = api
42320+
if (typeof global.wx === 'function') global.wx = Object.assign(api, global.wx)
42321+
else global.wx = api
4232142322
}
4232242323

4232342324
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))

docs/update.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# 更新日志
22

3+
## 1.5.4
4+
5+
* 修复 global.wx 赋值会覆盖用户模拟的 wx 对象问题
6+
37
## 1.5.3
48

59
* 支持子孙组件的 usingComponents 覆盖

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "miniprogram-simulate",
3-
"version": "1.5.3",
3+
"version": "1.5.4",
44
"description": "tools for miniprogram custom component unit test",
55
"main": "index.js",
66
"types": "index.d.ts",

src/definition.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ module.exports = function() {
2424
})
2525

2626
// 注入 api
27-
global.wx = api
27+
if (typeof global.wx === 'function') global.wx = Object.assign(api, global.wx)
28+
else global.wx = api
2829
}

0 commit comments

Comments
 (0)