export function shouldSkipAttr(
key: string,
+ value: any,
instance: ComponentInternalInstance
): boolean {
if (
) {
return true
}
+ // vue-router
+ if (key.startsWith('routerView') || key === 'registerRouteInstance') {
+ return true
+ }
return false
}
// copy prototype augmentations as config.globalProperties
if (isCompatEnabled(DeprecationTypes.GLOBAL_PROTOTYPE, null)) {
- app.config.globalProperties = extend(
- Object.create(Ctor.prototype),
- singletonApp.config.globalProperties
- )
+ app.config.globalProperties = Ctor.prototype
}
let hasPrototypeAugmentations = false
for (const key in Ctor.prototype) {
})
} else {
Object.keys(val).forEach(key => {
- defineReactiveSimple(val, key, val[key])
+ try {
+ defineReactiveSimple(val, key, val[key])
+ } catch (e) {}
})
}
}
$children: getCompatChildren,
$listeners: getCompatListeners,
- // inject parent into $options for compat
+ $vnode: i => i.vnode,
+
+ // inject addtional properties into $options for compat
$options: i => {
let res = resolveMergedOptions(i)
if (res === i.type) res = i.type.__merged = extend({}, res)
res.parent = i.proxy!.$parent
+ res.propsData = i.vnode.props
return res
},
resolveDynamicComponent
} from '../helpers/resolveAssets'
import {
+ Comment,
createVNode,
isVNode,
normalizeChildren,
propsOrChildren?: any,
children?: any
): VNode {
+ if (!type) {
+ type = Comment
+ }
+
// to support v2 string component name look!up
if (typeof type === 'string') {
const t = hyphenate(type)
}
}
}
+ } else if (key === 'hook') {
+ // TODO
} else if (!skipLegacyRootLevelProps(key)) {
converted[key] = legacyProps[key as keyof LegacyVNodeProps]
}
)
}
} else {
- if (__COMPAT__ && shouldSkipAttr(key, instance)) {
+ if (__COMPAT__ && shouldSkipAttr(key, attrs[key], instance)) {
continue
}
if (value !== attrs[key]) {
// Any non-declared (either as a prop or an emitted event) props are put
// into a separate `attrs` object for spreading. Make sure to preserve
// original key casing
- if (__COMPAT__ && shouldSkipAttr(key, instance)) {
+ if (__COMPAT__ && shouldSkipAttr(key, attrs[key], instance)) {
continue
}
if (value !== attrs[key]) {
hasOwn(globalProperties, key))
) {
if (__COMPAT__) {
- const val = globalProperties[key]
- return isFunction(val) ? val.bind(instance.proxy) : val
+ const desc = Object.getOwnPropertyDescriptor(globalProperties, key)!
+ if (desc.get) {
+ return desc.get.call(instance.proxy)
+ } else {
+ const val = globalProperties[key]
+ return isFunction(val) ? val.bind(instance.proxy) : val
+ }
} else {
return globalProperties[key]
}