Skip to content

Commit ad844cf

Browse files
committed
fix(compat): revert private properties on $options in comapt mode
fix #3883
1 parent 5bce2ae commit ad844cf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/runtime-core/src/compat/instance.ts

+10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
import { resolveFilter } from '../helpers/resolveAssets'
3838
import { InternalSlots, Slots } from '../componentSlots'
3939
import { ContextualRenderFn } from '../componentRenderContext'
40+
import { resolveMergedOptions } from '../componentOptions'
4041

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

131+
// inject addtional properties into $options for compat
132+
// e.g. vuex needs this.$options.parent
133+
$options: i => {
134+
const res = extend({}, resolveMergedOptions(i))
135+
res.parent = i.proxy!.$parent
136+
res.propsData = i.vnode.props
137+
return res
138+
},
139+
130140
// some private properties that are likely accessed...
131141
_self: i => i.proxy,
132142
_uid: i => i.uid,

0 commit comments

Comments
 (0)