@mpxjs/core 2.8.6 → 2.8.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.
|
|
3
|
+
"version": "2.8.7",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/didi/mpx/issues"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d064d3caf12023c955f79cecdb92b90d479a6a05"
|
|
51
51
|
}
|
|
@@ -48,30 +48,31 @@ if (isBrowser) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export default function pageStatusMixin (mixinType) {
|
|
51
|
+
const mixin = {}
|
|
52
|
+
|
|
51
53
|
if (mixinType === 'page') {
|
|
52
|
-
|
|
54
|
+
Object.assign(mixin, {
|
|
53
55
|
data: {
|
|
54
|
-
mpxPageStatus:
|
|
56
|
+
mpxPageStatus: null
|
|
55
57
|
},
|
|
56
58
|
activated () {
|
|
57
59
|
this.mpxPageStatus = 'show'
|
|
58
|
-
this.__mpxProxy.callHook(ONSHOW)
|
|
59
60
|
},
|
|
60
61
|
deactivated () {
|
|
61
62
|
this.mpxPageStatus = 'hide'
|
|
62
|
-
this.__mpxProxy.callHook(ONHIDE)
|
|
63
63
|
},
|
|
64
64
|
created () {
|
|
65
65
|
// onLoad应该在用户声明周期CREATED后再执行,故此处使用原生created声明周期来触发onLoad
|
|
66
66
|
const query = (global.__mpxRouter && global.__mpxRouter.currentRoute && global.__mpxRouter.currentRoute.query) || {}
|
|
67
67
|
this.__mpxProxy.callHook(ONLOAD, [query])
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
})
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
Object.assign(mixin, {
|
|
72
73
|
[CREATED] () {
|
|
73
|
-
const pageInstance = getCurrentPageInstance()
|
|
74
|
-
if (
|
|
74
|
+
const pageInstance = mixinType === 'page' ? this : getCurrentPageInstance()
|
|
75
|
+
if (pageInstance) {
|
|
75
76
|
this.$watch(() => pageInstance.mpxPageStatus, status => {
|
|
76
77
|
if (!status) return
|
|
77
78
|
if (status === 'show') this.__mpxProxy.callHook(ONSHOW)
|
|
@@ -91,5 +92,7 @@ export default function pageStatusMixin (mixinType) {
|
|
|
91
92
|
})
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
}
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
return mixin
|
|
95
98
|
}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import Vue from '../../vue'
|
|
2
2
|
import { injectMixins } from '../../core/injectMixins'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
delete: del
|
|
18
|
-
}
|
|
19
|
-
return APIs
|
|
4
|
+
const vm = new Vue()
|
|
5
|
+
const observable = Vue.observable.bind(Vue)
|
|
6
|
+
const watch = vm.$watch.bind(vm)
|
|
7
|
+
const set = Vue.set.bind(Vue)
|
|
8
|
+
const del = Vue.delete.bind(Vue)
|
|
9
|
+
|
|
10
|
+
const APIs = {
|
|
11
|
+
injectMixins,
|
|
12
|
+
mixin: injectMixins,
|
|
13
|
+
observable,
|
|
14
|
+
watch,
|
|
15
|
+
set,
|
|
16
|
+
delete: del
|
|
20
17
|
}
|
|
21
|
-
|
|
18
|
+
|
|
22
19
|
const InstanceAPIs = {}
|
|
20
|
+
|
|
23
21
|
export {
|
|
24
22
|
APIs,
|
|
25
23
|
InstanceAPIs
|