fix(compat): revert private properties on $options in comapt mode

fix #3883
This commit is contained in:
Evan You 2021-06-07 11:04:41 -04:00
parent 5bce2ae723
commit ad844cf1e7

View File

@ -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
@ -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,