Skip to content

Commit

Permalink
fix(compat): revert private properties on $options in comapt mode
Browse files Browse the repository at this point in the history
fix #3883
  • Loading branch information
yyx990803 committed Jun 7, 2021
1 parent 5bce2ae commit ad844cf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/runtime-core/src/compat/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
import { resolveFilter } from '../helpers/resolveAssets'
import { InternalSlots, Slots } from '../componentSlots'
import { ContextualRenderFn } from '../componentRenderContext'
import { resolveMergedOptions } from '../componentOptions'

export type LegacyPublicInstance = ComponentPublicInstance &
LegacyPublicProperties
Expand Down Expand Up @@ -127,6 +128,15 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
// needed by many libs / render fns
$vnode: i => i.vnode,

// inject addtional properties into $options for compat
// e.g. vuex needs this.$options.parent
$options: i => {
const res = extend({}, resolveMergedOptions(i))
res.parent = i.proxy!.$parent
res.propsData = i.vnode.props
return res
},

// some private properties that are likely accessed...
_self: i => i.proxy,
_uid: i => i.uid,
Expand Down

0 comments on commit ad844cf

Please sign in to comment.