Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuzhh committed Feb 27, 2024
1 parent a0b9dcc commit 03cc6ef
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/core/src/platform/builtInMixins/relationsMixin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isObject } from '@mpxjs/utils'
import { CREATED, MOUNTED, BEFOREUNMOUNT } from '../../core/innerLifecycle'
import { BEFORECREATE, MOUNTED, BEFOREUNMOUNT } from '../../core/innerLifecycle'

const targets = []
let curTarget = null
Expand Down Expand Up @@ -177,7 +177,7 @@ export default function relationsMixin (mixinType) {
}
} else if (__mpx_mode__ === 'web' && mixinType === 'component') {
return {
[CREATED] () {
[BEFORECREATE] () {
this.__mpxRelations = {}
this.__mpxRelationNodesMap = {} // 用于getRelationNodes关系查询
},
Expand Down Expand Up @@ -241,7 +241,7 @@ export default function relationsMixin (mixinType) {
const currentPath = this.$options.componentPath
if (type === 'linked') {
this.__mpxLinkRelationNodes(target, currentPath)
} else {
} else if (type === 'unlinked') {
this.__mpxRemoveRelationNodes(target, currentPath)
}
if (typeof targetRelation[type] === 'function') {
Expand All @@ -258,11 +258,8 @@ export default function relationsMixin (mixinType) {
},
__mpxRemoveRelationNodes (target, path) {
const arr = target.__mpxRelationNodesMap[path] || []
arr.forEach((vm, index) => {
if (vm === this) {
arr.splice(index, 1)
}
})
const index = arr.indexOf(this)
if (index !== -1) arr.splice(index, 1)
}
}
}
Expand Down

0 comments on commit 03cc6ef

Please sign in to comment.