@mpxjs/core 2.8.56 → 2.8.59
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.59",
|
|
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": "4e014ea355bb2d659c6fd6a3040b6b88245da9e5"
|
|
51
51
|
}
|
|
@@ -89,34 +89,22 @@ export default function proxyEventMixin () {
|
|
|
89
89
|
}
|
|
90
90
|
if (__mpx_mode__ === 'ali') {
|
|
91
91
|
Object.assign(methods, {
|
|
92
|
-
triggerEvent (eventName, eventDetail
|
|
92
|
+
triggerEvent (eventName, eventDetail) {
|
|
93
93
|
const handlerName = eventName.replace(/^./, matched => matched.toUpperCase()).replace(/-([a-z])/g, (match, p1) => p1.toUpperCase())
|
|
94
94
|
const handler = this.props && (this.props['on' + handlerName] || this.props['catch' + handlerName])
|
|
95
95
|
if (handler && typeof handler === 'function') {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
type: eventName,
|
|
106
|
-
timeStamp,
|
|
107
|
-
target: { id, dataset, targetDataset: dataset },
|
|
108
|
-
currentTarget: { id, dataset },
|
|
109
|
-
detail: eventDetail
|
|
110
|
-
}
|
|
96
|
+
const dataset = collectDataset(this.props)
|
|
97
|
+
const id = this.props.id || ''
|
|
98
|
+
const timeStamp = +new Date()
|
|
99
|
+
const eventObj = {
|
|
100
|
+
type: eventName,
|
|
101
|
+
timeStamp,
|
|
102
|
+
target: { id, dataset, targetDataset: dataset },
|
|
103
|
+
currentTarget: { id, dataset },
|
|
104
|
+
detail: eventDetail
|
|
111
105
|
}
|
|
112
106
|
handler.call(this, eventObj)
|
|
113
107
|
}
|
|
114
|
-
},
|
|
115
|
-
__proxyEvent (e) {
|
|
116
|
-
const eventName = e.type
|
|
117
|
-
// 保持和微信一致
|
|
118
|
-
e.target = e.currentTarget
|
|
119
|
-
this.triggerEvent(eventName, {}, e)
|
|
120
108
|
}
|
|
121
109
|
})
|
|
122
110
|
}
|
|
@@ -18,12 +18,6 @@ export default function proxyEventMixin () {
|
|
|
18
18
|
const originValue = valuePath.reduce((acc, cur) => acc[cur], $event.detail)
|
|
19
19
|
const value = filterMethod ? (innerFilter[filterMethod] ? innerFilter[filterMethod](originValue) : typeof this[filterMethod] === 'function' && this[filterMethod]) : originValue
|
|
20
20
|
setByPath(this, expr, value)
|
|
21
|
-
},
|
|
22
|
-
__proxyEvent (e) {
|
|
23
|
-
const type = e.type
|
|
24
|
-
// 保持和微信一致 target 和 currentTarget 相同
|
|
25
|
-
e.target = e.currentTarget
|
|
26
|
-
this.triggerEvent(type, {}, e)
|
|
27
21
|
}
|
|
28
22
|
}
|
|
29
23
|
}
|
package/src/vuePlugin.js
CHANGED
|
@@ -16,22 +16,17 @@ function collectDataset (attrs) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default function install (Vue) {
|
|
19
|
-
Vue.prototype.triggerEvent = function (eventName, eventDetail
|
|
19
|
+
Vue.prototype.triggerEvent = function (eventName, eventDetail) {
|
|
20
20
|
let eventObj = {}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
timeStamp,
|
|
31
|
-
target: { id, dataset, targetDataset: dataset },
|
|
32
|
-
currentTarget: { id, dataset },
|
|
33
|
-
detail: eventDetail
|
|
34
|
-
}
|
|
21
|
+
const dataset = collectDataset(this.$attrs)
|
|
22
|
+
const id = this.$attrs.id || ''
|
|
23
|
+
const timeStamp = +new Date()
|
|
24
|
+
eventObj = {
|
|
25
|
+
type: eventName,
|
|
26
|
+
timeStamp,
|
|
27
|
+
target: { id, dataset, targetDataset: dataset },
|
|
28
|
+
currentTarget: { id, dataset },
|
|
29
|
+
detail: eventDetail
|
|
35
30
|
}
|
|
36
31
|
return this.$emit(eventName, eventObj)
|
|
37
32
|
}
|