@mpxjs/api-proxy 2.7.44 → 2.7.52
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/api-proxy",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.52",
|
|
4
4
|
"description": "convert miniprogram API at each end",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"types": "@types/index.d.ts",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"axios": "^0.21.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "187abad504151455e045c0adf2fe7f81412e0fef"
|
|
43
43
|
}
|
|
@@ -636,7 +636,7 @@ const getWxToAliApi = ({ optimize = false }) => {
|
|
|
636
636
|
selectorQuery.exec = function (originalCb = noop) {
|
|
637
637
|
const cb = function (results) {
|
|
638
638
|
results.forEach((item, index) => {
|
|
639
|
-
cbs[index](item)
|
|
639
|
+
cbs[index] && cbs[index](item)
|
|
640
640
|
})
|
|
641
641
|
originalCb(results)
|
|
642
642
|
}
|
|
@@ -38,29 +38,34 @@ class SelectQuery {
|
|
|
38
38
|
const { selector, component, single, fields } = item
|
|
39
39
|
|
|
40
40
|
let curComponent = document
|
|
41
|
-
|
|
42
41
|
if (component && component.$el) {
|
|
43
42
|
curComponent = component.$el
|
|
44
43
|
} else if (component && component.nodeType === 1) {
|
|
45
44
|
curComponent = component
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.every(item => item === curComponent)
|
|
54
|
-
|
|
55
|
-
if (single) {
|
|
56
|
-
const el = selectSelf ? curComponent : curComponent.querySelector(selector)
|
|
57
|
-
res.push(handleFields(fields, el, selector))
|
|
46
|
+
if (this._isEl(selector)) {
|
|
47
|
+
if (single) {
|
|
48
|
+
res.push(handleFields(fields, selector, null))
|
|
49
|
+
} else {
|
|
50
|
+
res.push(selector.map(el => handleFields(fields, el, null)))
|
|
51
|
+
}
|
|
58
52
|
} else {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
const selectSelf =
|
|
54
|
+
curComponent === document
|
|
55
|
+
? false
|
|
56
|
+
: Array
|
|
57
|
+
.from(curComponent.parentNode.querySelectorAll(selector))
|
|
58
|
+
.every(item => item === curComponent)
|
|
59
|
+
if (single) {
|
|
60
|
+
const el = selectSelf ? curComponent : curComponent.querySelector(selector)
|
|
61
|
+
res.push(handleFields(fields, el, selector))
|
|
62
|
+
} else {
|
|
63
|
+
const els = selectSelf
|
|
64
|
+
? [curComponent]
|
|
65
|
+
: curComponent.querySelectorAll(selector)
|
|
66
|
+
const elsArr = Array.from(els).map(el => handleFields(fields, el, null))
|
|
67
|
+
res.push(elsArr)
|
|
68
|
+
}
|
|
64
69
|
}
|
|
65
70
|
})
|
|
66
71
|
res.forEach((item, idx) => {
|
|
@@ -162,6 +167,10 @@ class SelectQuery {
|
|
|
162
167
|
})
|
|
163
168
|
this._queueCb.push(callback)
|
|
164
169
|
}
|
|
170
|
+
_isEl (selector) {
|
|
171
|
+
if (Array.isArray(selector)) return this._isEl(selector[0])
|
|
172
|
+
return selector && selector.nodeType === 1
|
|
173
|
+
}
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
export default SelectQuery
|