@mpxjs/core 2.9.27 → 2.9.32

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.9.27",
3
+ "version": "2.9.32",
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": "3939aaaa7d9be0c86e51da16080a6cd8d7863a1a"
50
+ "gitHead": "61ac5a85a2b75304d8b989d4291b4f606f50d82f"
51
51
  }
@@ -6,36 +6,39 @@ function getEl (ref) {
6
6
  if (ref && ref.$options && ref.$options.__mpxBuiltIn) return ref.$el
7
7
  }
8
8
 
9
- function processRefs (refs) {
10
- Object.keys(refs).forEach((key) => {
11
- const matched = /^__mpx_ref_(.+)__$/.exec(key)
12
- const rKey = matched && matched[1]
13
- if (rKey) {
14
- const ref = refs[key]
15
- if (Array.isArray(ref)) {
16
- if (getEl(ref[0])) {
17
- refs[rKey] = createSelectorQuery().in(this).selectAll(ref.map(getEl))
9
+ function processRefs (target) {
10
+ const refs = target.$refs
11
+ if (refs) {
12
+ Object.keys(refs).forEach((key) => {
13
+ const matched = /^__mpx_ref_(.+)__$/.exec(key)
14
+ const rKey = matched && matched[1]
15
+ if (rKey) {
16
+ const ref = refs[key]
17
+ if (Array.isArray(ref)) {
18
+ if (getEl(ref[0])) {
19
+ refs[rKey] = createSelectorQuery().in(target).selectAll(ref.map(getEl))
20
+ } else {
21
+ refs[rKey] = ref
22
+ }
18
23
  } else {
19
- refs[rKey] = ref
20
- }
21
- } else {
22
- if (getEl(ref)) {
23
- refs[rKey] = createSelectorQuery().in(this).select(getEl(ref))
24
- } else {
25
- refs[rKey] = ref
24
+ if (getEl(ref)) {
25
+ refs[rKey] = createSelectorQuery().in(target).select(getEl(ref))
26
+ } else {
27
+ refs[rKey] = ref
28
+ }
26
29
  }
27
30
  }
28
- }
29
- })
31
+ })
32
+ }
30
33
  }
31
34
 
32
35
  export default function getRefsMixin () {
33
36
  return {
34
37
  [BEFOREMOUNT] () {
35
- processRefs(this.$refs || {})
38
+ processRefs(this)
36
39
  },
37
40
  [UPDATED] () {
38
- processRefs(this.$refs || {})
41
+ processRefs(this)
39
42
  }
40
43
  }
41
44
  }