fix(compat): revert private properties on $options in comapt mode
fix #3883
This commit is contained in:
parent
5bce2ae723
commit
ad844cf1e7
@ -37,6 +37,7 @@ import {
|
|||||||
import { resolveFilter } from '../helpers/resolveAssets'
|
import { resolveFilter } from '../helpers/resolveAssets'
|
||||||
import { InternalSlots, Slots } from '../componentSlots'
|
import { InternalSlots, Slots } from '../componentSlots'
|
||||||
import { ContextualRenderFn } from '../componentRenderContext'
|
import { ContextualRenderFn } from '../componentRenderContext'
|
||||||
|
import { resolveMergedOptions } from '../componentOptions'
|
||||||
|
|
||||||
export type LegacyPublicInstance = ComponentPublicInstance &
|
export type LegacyPublicInstance = ComponentPublicInstance &
|
||||||
LegacyPublicProperties
|
LegacyPublicProperties
|
||||||
@ -127,6 +128,15 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
|
|||||||
// needed by many libs / render fns
|
// needed by many libs / render fns
|
||||||
$vnode: i => i.vnode,
|
$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...
|
// some private properties that are likely accessed...
|
||||||
_self: i => i.proxy,
|
_self: i => i.proxy,
|
||||||
_uid: i => i.uid,
|
_uid: i => i.uid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user