wip: enable private vnode properties even for built-ins
This commit is contained in:
parent
ae0fb14305
commit
7e6a76e587
@ -566,10 +566,11 @@ export function getCompatConfigForKey(
|
|||||||
|
|
||||||
export function isCompatEnabled(
|
export function isCompatEnabled(
|
||||||
key: DeprecationTypes,
|
key: DeprecationTypes,
|
||||||
instance: ComponentInternalInstance | null
|
instance: ComponentInternalInstance | null,
|
||||||
|
enableForBuiltIn = false
|
||||||
): boolean {
|
): boolean {
|
||||||
// skip compat for built-in components
|
// skip compat for built-in components
|
||||||
if (instance && instance.type.__isBuiltIn) {
|
if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,16 +307,21 @@ export function defineLegacyVNodeProperties(vnode: VNode) {
|
|||||||
if (
|
if (
|
||||||
isCompatEnabled(
|
isCompatEnabled(
|
||||||
DeprecationTypes.RENDER_FUNCTION,
|
DeprecationTypes.RENDER_FUNCTION,
|
||||||
currentRenderingInstance
|
currentRenderingInstance,
|
||||||
|
true /* enable for built-ins */
|
||||||
) &&
|
) &&
|
||||||
isCompatEnabled(DeprecationTypes.PRIVATE_APIS, currentRenderingInstance)
|
isCompatEnabled(
|
||||||
|
DeprecationTypes.PRIVATE_APIS,
|
||||||
|
currentRenderingInstance,
|
||||||
|
true /* enable for built-ins */
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
const context = currentRenderingInstance
|
const context = currentRenderingInstance
|
||||||
const getInstance = () => vnode.component && vnode.component.proxy
|
const getInstance = () => vnode.component && vnode.component.proxy
|
||||||
let componentOptions: any
|
let componentOptions: any
|
||||||
Object.defineProperties(vnode, {
|
Object.defineProperties(vnode, {
|
||||||
tag: { get: () => vnode.type },
|
tag: { get: () => vnode.type },
|
||||||
data: { get: () => vnode.props, set: p => (vnode.props = p) },
|
data: { get: () => vnode.props || {}, set: p => (vnode.props = p) },
|
||||||
elm: { get: () => vnode.el },
|
elm: { get: () => vnode.el },
|
||||||
componentInstance: { get: getInstance },
|
componentInstance: { get: getInstance },
|
||||||
child: { get: getInstance },
|
child: { get: getInstance },
|
||||||
|
Loading…
Reference in New Issue
Block a user