@mpxjs/core 2.8.25-alpha.4 → 2.8.25-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.8.25-alpha.4",
3
+ "version": "2.8.25-alpha.7",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -49,5 +49,5 @@
49
49
  "url": "https://github.com/didi/mpx/issues"
50
50
  },
51
51
  "sideEffects": false,
52
- "gitHead": "9684484c1b348bcb8d8325df75a114ba9611811e"
52
+ "gitHead": "87e767a174417796a9188daf45ddd27d6a3ec424"
53
53
  }
@@ -15,7 +15,7 @@ export default function pageStatusMixin (mixinType) {
15
15
  this.__mpxProxy.callHook(ONHIDE)
16
16
  },
17
17
  onBack () {
18
- this.onBack && this.onBack()
18
+ return this.onBack && this.onBack()
19
19
  }
20
20
  }
21
21
  }
@@ -4,6 +4,11 @@ import {
4
4
  onScopeDispose
5
5
  } from '@hummer/tenon-vue'
6
6
 
7
+ import {
8
+ hasOwn,
9
+ isValidArrayIndex
10
+ } from '@mpxjs/utils'
11
+
7
12
  export {
8
13
  // watch
9
14
  watchEffect,
@@ -14,8 +19,6 @@ export {
14
19
  reactive,
15
20
  isReactive,
16
21
  shallowReactive,
17
- set,
18
- del,
19
22
  markRaw,
20
23
  // ref
21
24
  ref,
@@ -32,6 +35,27 @@ export {
32
35
  getCurrentInstance
33
36
  } from '@hummer/tenon-vue'
34
37
 
38
+ export function set (target, key, val) {
39
+ if (Array.isArray(target) && isValidArrayIndex(key)) {
40
+ target.length = Math.max(target.length, key)
41
+ target.splice(key, 1, val)
42
+ return val
43
+ }
44
+ target[key] = val
45
+ return val
46
+ }
47
+
48
+ export function del (target, key) {
49
+ if (Array.isArray(target) && isValidArrayIndex(key)) {
50
+ target.splice(key, 1)
51
+ return
52
+ }
53
+ if (!hasOwn(target, key)) {
54
+ return
55
+ }
56
+ delete target[key]
57
+ }
58
+
35
59
  const noop = () => {
36
60
  }
37
61